@intlayer/chokidar 5.5.3 → 5.5.4

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 (81) hide show
  1. package/dist/cjs/chokidar/watcher.cjs +12 -3
  2. package/dist/cjs/chokidar/watcher.cjs.map +1 -1
  3. package/dist/cjs/getBuiltDynamicDictionariesPath.cjs +52 -0
  4. package/dist/cjs/getBuiltDynamicDictionariesPath.cjs.map +1 -0
  5. package/dist/cjs/{filterDictionaryLocales.cjs → getFilteredLocalesContent.cjs} +25 -13
  6. package/dist/cjs/getFilteredLocalesContent.cjs.map +1 -0
  7. package/dist/cjs/index.cjs +3 -3
  8. package/dist/cjs/index.cjs.map +1 -1
  9. package/dist/cjs/prepareIntlayer.cjs +5 -2
  10. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  11. package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs +0 -1
  12. package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs.map +1 -1
  13. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs +19 -8
  14. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs.map +1 -1
  15. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.cjs +30 -0
  16. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.cjs.map +1 -0
  17. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs +107 -0
  18. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs.map +1 -0
  19. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs +59 -0
  20. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs.map +1 -0
  21. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs +65 -0
  22. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs.map +1 -0
  23. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +44 -35
  24. package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
  25. package/dist/esm/chokidar/watcher.mjs +12 -3
  26. package/dist/esm/chokidar/watcher.mjs.map +1 -1
  27. package/dist/esm/getBuiltDynamicDictionariesPath.mjs +18 -0
  28. package/dist/esm/getBuiltDynamicDictionariesPath.mjs.map +1 -0
  29. package/dist/esm/{filterDictionaryLocales.mjs → getFilteredLocalesContent.mjs} +21 -9
  30. package/dist/esm/getFilteredLocalesContent.mjs.map +1 -0
  31. package/dist/esm/index.mjs +2 -2
  32. package/dist/esm/index.mjs.map +1 -1
  33. package/dist/esm/prepareIntlayer.mjs +5 -2
  34. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  35. package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs +0 -1
  36. package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs.map +1 -1
  37. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs +19 -8
  38. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs.map +1 -1
  39. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.mjs +6 -0
  40. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.mjs.map +1 -0
  41. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs +82 -0
  42. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs.map +1 -0
  43. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs +35 -0
  44. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs.map +1 -0
  45. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs +41 -0
  46. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs.map +1 -0
  47. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +44 -35
  48. package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
  49. package/dist/types/chokidar/watcher.d.ts.map +1 -1
  50. package/dist/types/getBuiltDynamicDictionariesPath.d.ts +5 -0
  51. package/dist/types/getBuiltDynamicDictionariesPath.d.ts.map +1 -0
  52. package/dist/types/getFilteredLocalesContent.d.ts +4 -0
  53. package/dist/types/getFilteredLocalesContent.d.ts.map +1 -0
  54. package/dist/types/index.d.ts +1 -1
  55. package/dist/types/index.d.ts.map +1 -1
  56. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  57. package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts +5 -1
  58. package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts.map +1 -1
  59. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts +5 -1
  60. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +1 -1
  61. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.d.ts +2 -0
  62. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.d.ts.map +1 -0
  63. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts +31 -0
  64. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts.map +1 -0
  65. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts +25 -0
  66. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts.map +1 -0
  67. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.d.ts +28 -0
  68. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +1 -0
  69. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts +1 -1
  70. package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +1 -1
  71. package/package.json +12 -12
  72. package/dist/cjs/filterDictionaryLocales.cjs.map +0 -1
  73. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.cjs +0 -97
  74. package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.cjs.map +0 -1
  75. package/dist/esm/filterDictionaryLocales.mjs.map +0 -1
  76. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.mjs +0 -71
  77. package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.mjs.map +0 -1
  78. package/dist/types/filterDictionaryLocales.d.ts +0 -4
  79. package/dist/types/filterDictionaryLocales.d.ts.map +0 -1
  80. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.d.ts +0 -41
  81. package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDictionary.d.ts.map +0 -1
@@ -47,7 +47,10 @@ const handleAdditionalContentDeclarationFile = async (filePath, configuration) =
47
47
  }
48
48
  );
49
49
  const localeDictionaries = await (0, import_loadLocalDictionaries.loadLocalDictionaries)(filePath);
50
- const dictionariesPaths = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries);
50
+ const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries);
51
+ const dictionariesPaths = Object.values(
52
+ dictionariesOutput?.mergedDictionaries ?? {}
53
+ ).map((dictionary) => dictionary.dictionaryPath);
51
54
  (0, import_dictionary_to_type.createTypes)(dictionariesPaths);
52
55
  (0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
53
56
  appLogger("Dictionaries built", {
@@ -67,7 +70,10 @@ const handleUnlikedContentDeclarationFile = async (filePath, configuration) => {
67
70
  });
68
71
  const files = (0, import_listDictionariesPath.listDictionaries)(configuration);
69
72
  const localeDictionaries = await (0, import_loadLocalDictionaries.loadLocalDictionaries)(files);
70
- const dictionariesPaths = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries);
73
+ const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries);
74
+ const dictionariesPaths = Object.values(
75
+ dictionariesOutput?.mergedDictionaries ?? {}
76
+ ).map((dictionary) => dictionary.dictionaryPath);
71
77
  (0, import_dictionary_to_type.createTypes)(dictionariesPaths);
72
78
  (0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
73
79
  appLogger("Dictionaries rebuilt", {
@@ -86,7 +92,10 @@ const handleContentDeclarationFileChange = async (filePath, configuration) => {
86
92
  isVerbose: true
87
93
  });
88
94
  const localeDictionaries = await (0, import_loadLocalDictionaries.loadLocalDictionaries)(filePath);
89
- const updatedDictionariesPaths = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries);
95
+ const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(localeDictionaries);
96
+ const updatedDictionariesPaths = Object.values(
97
+ dictionariesOutput?.mergedDictionaries ?? {}
98
+ ).map((dictionary) => dictionary.dictionaryPath);
90
99
  const allDictionariesPaths = (0, import_getBuiltDictionariesPath.getBuiltDictionariesPath)();
91
100
  (0, import_dictionary_to_type.createTypes)(updatedDictionariesPaths);
92
101
  appLogger("TypeScript types built", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/chokidar/watcher.ts"],"sourcesContent":["import {\n GetConfigurationOptions,\n type IntlayerConfig,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { basename, relative } from 'path';\n/** @ts-ignore remove error Module '\"chokidar\"' has no exported member 'ChokidarOptions' */\nimport { type ChokidarOptions, watch as chokidarWatch } from 'chokidar';\nimport { getBuiltDictionariesPath } from '../getBuiltDictionariesPath';\nimport { listDictionaries } from '../listDictionariesPath';\nimport { loadLocalDictionaries } from '../loadDictionaries/loadLocalDictionaries';\nimport { prepareIntlayer } from '../prepareIntlayer';\nimport { buildDictionary } from '../transpiler/declaration_file_to_dictionary/index';\nimport { createDictionaryEntryPoint } from '../transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from '../transpiler/dictionary_to_type/index';\n\nconst recentlyAddedFiles = new Set<string>();\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n configuration?: IntlayerConfig\n) => {\n const config = configuration ?? getConfiguration();\n const appLogger = getAppLogger(config);\n const { content } = config;\n\n // Process the file with the functionToRun\n appLogger(\n `Additional file detected: ${relative(content.baseDir, filePath)}`,\n {\n isVerbose: true,\n }\n );\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const dictionariesPaths = await buildDictionary(localeDictionaries);\n\n createTypes(dictionariesPaths);\n\n createDictionaryEntryPoint();\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation();\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n};\n\nexport const handleUnlikedContentDeclarationFile = async (\n filePath: string,\n configuration?: IntlayerConfig\n) => {\n const config = configuration ?? getConfiguration();\n const appLogger = getAppLogger(config);\n const { content } = config;\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${relative(content.baseDir, filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = listDictionaries(configuration);\n\n const localeDictionaries = await loadLocalDictionaries(files);\n\n const dictionariesPaths = await buildDictionary(localeDictionaries);\n\n createTypes(dictionariesPaths);\n\n createDictionaryEntryPoint();\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n createModuleAugmentation();\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n};\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n configuration?: IntlayerConfig\n) => {\n const config = configuration ?? getConfiguration();\n const appLogger = getAppLogger(config);\n const { content } = config;\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${relative(content.baseDir, filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const updatedDictionariesPaths = await buildDictionary(localeDictionaries);\n const allDictionariesPaths: string[] = getBuiltDictionariesPath();\n\n createTypes(updatedDictionariesPaths);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (\n updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n )\n ) {\n createDictionaryEntryPoint();\n\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n};\n\ntype WatchOptions = ChokidarOptions & {\n configuration?: IntlayerConfig;\n configOptions?: GetConfigurationOptions;\n};\n\n// Initialize chokidar watcher (non-persistent)\nexport const watch = (options?: WatchOptions) => {\n const configuration = options?.configuration ?? getConfiguration();\n const appLogger = getAppLogger(configuration);\n\n const { watch: isWatchMode, watchedFilesPatternWithPath } =\n configuration.content;\n\n /** @ts-ignore remove error Expected 0-1 arguments, but got 2. */\n return chokidarWatch(watchedFilesPatternWithPath, {\n persistent: isWatchMode, // Make the watcher persistent\n ignoreInitial: true, // Process existing files\n ...options,\n })\n .on('add', async (filePath) => {\n const fileName = basename(filePath);\n recentlyAddedFiles.add(fileName);\n\n await handleAdditionalContentDeclarationFile(filePath, configuration);\n\n setTimeout(() => recentlyAddedFiles.delete(fileName), 1000); // Allow time for unlink to trigger if it's a move\n })\n .on(\n 'change',\n async (filePath) =>\n await handleContentDeclarationFileChange(filePath, configuration)\n )\n .on('unlink', async (filePath) => {\n setTimeout(async () => {\n const fileName = basename(filePath);\n\n if (recentlyAddedFiles.has(fileName)) {\n // The file was moved, so ignore unlink\n return;\n }\n\n await handleUnlikedContentDeclarationFile(filePath, configuration);\n }, 300); // Allow time for unlink to trigger if it's a move\n })\n .on('error', async (error) => {\n appLogger('Watcher error: ' + error, {\n level: 'error',\n });\n\n appLogger('Restarting watcher');\n\n await prepareIntlayer(configuration);\n });\n};\n\nexport const buildAndWatchIntlayer = async (options?: WatchOptions) => {\n const configuration =\n options?.configuration ?? getConfiguration(options?.configOptions);\n\n await prepareIntlayer(configuration);\n\n if (configuration.content.watch || options.persistent) {\n // Start watching (assuming watch is also async)\n watch({ ...options, configuration });\n }\n};\n"],"mappings":"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","names":["chokidarWatch"]}
1
+ {"version":3,"sources":["../../../src/chokidar/watcher.ts"],"sourcesContent":["import {\n GetConfigurationOptions,\n type IntlayerConfig,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { basename, relative } from 'path';\n/** @ts-ignore remove error Module '\"chokidar\"' has no exported member 'ChokidarOptions' */\nimport { type ChokidarOptions, watch as chokidarWatch } from 'chokidar';\nimport { getBuiltDictionariesPath } from '../getBuiltDictionariesPath';\nimport { listDictionaries } from '../listDictionariesPath';\nimport { loadLocalDictionaries } from '../loadDictionaries/loadLocalDictionaries';\nimport { prepareIntlayer } from '../prepareIntlayer';\nimport { buildDictionary } from '../transpiler/declaration_file_to_dictionary/index';\nimport { createDictionaryEntryPoint } from '../transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from '../transpiler/dictionary_to_type/index';\n\nconst recentlyAddedFiles = new Set<string>();\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n configuration?: IntlayerConfig\n) => {\n const config = configuration ?? getConfiguration();\n const appLogger = getAppLogger(config);\n const { content } = config;\n\n // Process the file with the functionToRun\n appLogger(\n `Additional file detected: ${relative(content.baseDir, filePath)}`,\n {\n isVerbose: true,\n }\n );\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n createTypes(dictionariesPaths);\n\n createDictionaryEntryPoint();\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation();\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n};\n\nexport const handleUnlikedContentDeclarationFile = async (\n filePath: string,\n configuration?: IntlayerConfig\n) => {\n const config = configuration ?? getConfiguration();\n const appLogger = getAppLogger(config);\n const { content } = config;\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${relative(content.baseDir, filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = listDictionaries(configuration);\n\n const localeDictionaries = await loadLocalDictionaries(files);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n createTypes(dictionariesPaths);\n\n createDictionaryEntryPoint();\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n createModuleAugmentation();\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n};\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n configuration?: IntlayerConfig\n) => {\n const config = configuration ?? getConfiguration();\n const appLogger = getAppLogger(config);\n const { content } = config;\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${relative(content.baseDir, filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries);\n const updatedDictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n const allDictionariesPaths: string[] = getBuiltDictionariesPath();\n\n createTypes(updatedDictionariesPaths);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (\n updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n )\n ) {\n createDictionaryEntryPoint();\n\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n};\n\ntype WatchOptions = ChokidarOptions & {\n configuration?: IntlayerConfig;\n configOptions?: GetConfigurationOptions;\n};\n\n// Initialize chokidar watcher (non-persistent)\nexport const watch = (options?: WatchOptions) => {\n const configuration = options?.configuration ?? getConfiguration();\n const appLogger = getAppLogger(configuration);\n\n const { watch: isWatchMode, watchedFilesPatternWithPath } =\n configuration.content;\n\n /** @ts-ignore remove error Expected 0-1 arguments, but got 2. */\n return chokidarWatch(watchedFilesPatternWithPath, {\n persistent: isWatchMode, // Make the watcher persistent\n ignoreInitial: true, // Process existing files\n ...options,\n })\n .on('add', async (filePath) => {\n const fileName = basename(filePath);\n recentlyAddedFiles.add(fileName);\n\n await handleAdditionalContentDeclarationFile(filePath, configuration);\n\n setTimeout(() => recentlyAddedFiles.delete(fileName), 1000); // Allow time for unlink to trigger if it's a move\n })\n .on(\n 'change',\n async (filePath) =>\n await handleContentDeclarationFileChange(filePath, configuration)\n )\n .on('unlink', async (filePath) => {\n setTimeout(async () => {\n const fileName = basename(filePath);\n\n if (recentlyAddedFiles.has(fileName)) {\n // The file was moved, so ignore unlink\n return;\n }\n\n await handleUnlikedContentDeclarationFile(filePath, configuration);\n }, 300); // Allow time for unlink to trigger if it's a move\n })\n .on('error', async (error) => {\n appLogger('Watcher error: ' + error, {\n level: 'error',\n });\n\n appLogger('Restarting watcher');\n\n await prepareIntlayer(configuration);\n });\n};\n\nexport const buildAndWatchIntlayer = async (options?: WatchOptions) => {\n const configuration =\n options?.configuration ?? getConfiguration(options?.configOptions);\n\n await prepareIntlayer(configuration);\n\n if (configuration.content.watch || options.persistent) {\n // Start watching (assuming watch is also async)\n watch({ ...options, configuration });\n }\n};\n"],"mappings":"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","names":["chokidarWatch"]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var getBuiltDynamicDictionariesPath_exports = {};
30
+ __export(getBuiltDynamicDictionariesPath_exports, {
31
+ getBuiltDynamicDictionariesPath: () => getBuiltDynamicDictionariesPath
32
+ });
33
+ module.exports = __toCommonJS(getBuiltDynamicDictionariesPath_exports);
34
+ var import_config = require("@intlayer/config");
35
+ var import_fast_glob = __toESM(require("fast-glob"));
36
+ var import_fs = require("fs");
37
+ const getBuiltDynamicDictionariesPath = (configuration = (0, import_config.getConfiguration)(), format = "esm") => {
38
+ const { dynamicDictionariesDir, mainDir } = configuration.content;
39
+ if (!(0, import_fs.existsSync)(mainDir)) {
40
+ (0, import_fs.mkdirSync)(mainDir, { recursive: true });
41
+ }
42
+ const extension = format === "cjs" ? "cjs" : "mjs";
43
+ const dictionariesPath = import_fast_glob.default.sync(
44
+ `${dynamicDictionariesDir}/**/*.${extension}`
45
+ );
46
+ return dictionariesPath;
47
+ };
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ getBuiltDynamicDictionariesPath
51
+ });
52
+ //# sourceMappingURL=getBuiltDynamicDictionariesPath.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getBuiltDynamicDictionariesPath.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { existsSync, mkdirSync } from 'fs';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltDynamicDictionariesPath = (\n configuration = getConfiguration(),\n format: 'cjs' | 'esm' = 'esm'\n) => {\n const { dynamicDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const dictionariesPath: string[] = fg.sync(\n `${dynamicDictionariesDir}/**/*.${extension}`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AACjC,uBAAe;AACf,gBAAsC;AAK/B,MAAM,kCAAkC,CAC7C,oBAAgB,gCAAiB,GACjC,SAAwB,UACrB;AACH,QAAM,EAAE,wBAAwB,QAAQ,IAAI,cAAc;AAG1D,MAAI,KAAC,sBAAW,OAAO,GAAG;AACxB,6BAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,YAAY,WAAW,QAAQ,QAAQ;AAE7C,QAAM,mBAA6B,iBAAAA,QAAG;AAAA,IACpC,GAAG,sBAAsB,SAAS,SAAS;AAAA,EAC7C;AAEA,SAAO;AACT;","names":["fg"]}
@@ -16,20 +16,27 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var filterDictionaryLocales_exports = {};
20
- __export(filterDictionaryLocales_exports, {
21
- filterDictionaryLocales: () => filterDictionaryLocales
19
+ var getFilteredLocalesContent_exports = {};
20
+ __export(getFilteredLocalesContent_exports, {
21
+ getFilteredLocalesContent: () => getFilteredLocalesContent
22
22
  });
23
- module.exports = __toCommonJS(filterDictionaryLocales_exports);
23
+ module.exports = __toCommonJS(getFilteredLocalesContent_exports);
24
24
  var import_core = require("@intlayer/core");
25
- const filterTranlationsPlugin = (locales) => ({
25
+ const filterTranlationsPlugin = (locales, fallback = void 0) => ({
26
26
  id: "filter-translations-plugin",
27
27
  canHandle: (node) => typeof node === "object" && node?.nodeType === import_core.NodeType.Translation,
28
28
  transform: (node, props, deepTransformNode2) => {
29
29
  const translationMap = node.translation;
30
30
  const localesArray = Array.isArray(locales) ? locales : [locales];
31
31
  const isSingleLocale = localesArray.length === 1;
32
- const filteredTranslationMap = isSingleLocale ? translationMap[localesArray[0]] : Object.fromEntries(
32
+ if (isSingleLocale) {
33
+ let content = translationMap[localesArray[0]];
34
+ if (typeof content === "undefined" && fallback) {
35
+ content = translationMap[fallback];
36
+ }
37
+ return deepTransformNode2(content, props);
38
+ }
39
+ const filteredTranslationMap = Object.fromEntries(
33
40
  Object.entries(translationMap).filter(
34
41
  ([key]) => locales.includes(key)
35
42
  )
@@ -46,13 +53,18 @@ const filterTranlationsPlugin = (locales) => ({
46
53
  };
47
54
  }
48
55
  });
49
- const filterDictionaryLocales = (dictionary, locales) => (0, import_core.deepTransformNode)(dictionary, {
50
- plugins: [filterTranlationsPlugin(locales)],
51
- dictionaryKey: dictionary.key,
52
- keyPath: []
53
- });
56
+ const getFilteredLocalesContent = (node, locale, nodeProps, fallback) => {
57
+ const plugins = [
58
+ filterTranlationsPlugin(locale, fallback),
59
+ ...nodeProps.plugins ?? []
60
+ ];
61
+ return (0, import_core.deepTransformNode)(node, {
62
+ ...nodeProps,
63
+ plugins
64
+ });
65
+ };
54
66
  // Annotate the CommonJS export names for ESM import in node:
55
67
  0 && (module.exports = {
56
- filterDictionaryLocales
68
+ getFilteredLocalesContent
57
69
  });
58
- //# sourceMappingURL=filterDictionaryLocales.cjs.map
70
+ //# sourceMappingURL=getFilteredLocalesContent.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getFilteredLocalesContent.ts"],"sourcesContent":["import type { Locales, LocalesValues } from '@intlayer/config/client';\nimport {\n ContentNode,\n deepTransformNode,\n NodeType,\n type NodeProps,\n type Plugins,\n} from '@intlayer/core';\n\nconst filterTranlationsPlugin = (\n locales: LocalesValues[] | LocalesValues,\n fallback: LocalesValues | undefined = undefined // fallback mean that if field is not translated, it will use the default locale,\n): Plugins => ({\n id: 'filter-translations-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node, props, deepTransformNode) => {\n const translationMap = node.translation as Record<Locales, string>;\n\n const localesArray = Array.isArray(locales) ? locales : [locales];\n const isSingleLocale = localesArray.length === 1;\n\n if (isSingleLocale) {\n let content = translationMap[localesArray[0] as Locales];\n\n if (typeof content === 'undefined' && fallback) {\n content = translationMap[fallback as Locales];\n }\n\n return deepTransformNode(content, props);\n }\n\n const filteredTranslationMap = Object.fromEntries(\n Object.entries(translationMap).filter(([key]) =>\n locales.includes(key as Locales)\n )\n );\n\n return {\n ...node,\n translation: deepTransformNode(filteredTranslationMap, {\n ...props,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Object, key: NodeType.Translation },\n ],\n }),\n };\n },\n});\n\nexport const getFilteredLocalesContent = (\n node: ContentNode,\n locale: LocalesValues | LocalesValues[],\n nodeProps: NodeProps,\n fallback?: LocalesValues // fallback mean that if field is not translated, it will use the default locale,\n) => {\n const plugins: Plugins[] = [\n filterTranlationsPlugin(locale, fallback),\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAMO;AAEP,MAAM,0BAA0B,CAC9B,SACA,WAAsC,YACzB;AAAA,EACb,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,qBAAS;AAAA,EAC1D,WAAW,CAAC,MAAM,OAAOA,uBAAsB;AAC7C,UAAM,iBAAiB,KAAK;AAE5B,UAAM,eAAe,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO;AAChE,UAAM,iBAAiB,aAAa,WAAW;AAE/C,QAAI,gBAAgB;AAClB,UAAI,UAAU,eAAe,aAAa,CAAC,CAAY;AAEvD,UAAI,OAAO,YAAY,eAAe,UAAU;AAC9C,kBAAU,eAAe,QAAmB;AAAA,MAC9C;AAEA,aAAOA,mBAAkB,SAAS,KAAK;AAAA,IACzC;AAEA,UAAM,yBAAyB,OAAO;AAAA,MACpC,OAAO,QAAQ,cAAc,EAAE;AAAA,QAAO,CAAC,CAAC,GAAG,MACzC,QAAQ,SAAS,GAAc;AAAA,MACjC;AAAA,IACF;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,aAAaA,mBAAkB,wBAAwB;AAAA,QACrD,GAAG;AAAA,QACH,SAAS;AAAA,UACP,GAAG,MAAM;AAAA,UACT,EAAE,MAAM,qBAAS,QAAQ,KAAK,qBAAS,YAAY;AAAA,QACrD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,4BAA4B,CACvC,MACA,QACA,WACA,aACG;AACH,QAAM,UAAqB;AAAA,IACzB,wBAAwB,QAAQ,QAAQ;AAAA,IACxC,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,aAAO,+BAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":["deepTransformNode"]}
@@ -26,11 +26,11 @@ __export(index_exports, {
26
26
  createModuleAugmentation: () => import_createModuleAugmentation.createModuleAugmentation,
27
27
  fetchDistantDictionaries: () => import_fetchDistantDictionaries.fetchDistantDictionaries,
28
28
  fetchDistantDictionaryKeys: () => import_fetchDistantDictionaryKeys.fetchDistantDictionaryKeys,
29
- filterDictionaryLocales: () => import_filterDictionaryLocales.filterDictionaryLocales,
30
29
  generateDictionaryListContent: () => import_dictionary_to_main.generateDictionaryListContent,
31
30
  getBuiltDictionariesPath: () => import_getBuiltDictionariesPath.getBuiltDictionariesPath,
32
31
  getBuiltUnmergedDictionariesPath: () => import_getBuiltUnmergedDictionariesPath.getBuiltUnmergedDictionariesPath,
33
32
  getFileHash: () => import_utils.getFileHash,
33
+ getFilteredLocalesContent: () => import_getFilteredLocalesContent.getFilteredLocalesContent,
34
34
  handleAdditionalContentDeclarationFile: () => import_watcher.handleAdditionalContentDeclarationFile,
35
35
  handleContentDeclarationFileChange: () => import_watcher.handleContentDeclarationFileChange,
36
36
  listDictionaries: () => import_listDictionariesPath.listDictionaries,
@@ -52,9 +52,9 @@ var import_watcher = require('./chokidar/watcher.cjs');
52
52
  var import_cleanOutputDir = require('./cleanOutputDir.cjs');
53
53
  var import_fetchDistantDictionaries = require('./fetchDistantDictionaries.cjs');
54
54
  var import_fetchDistantDictionaryKeys = require('./fetchDistantDictionaryKeys.cjs');
55
- var import_filterDictionaryLocales = require('./filterDictionaryLocales.cjs');
56
55
  var import_getBuiltDictionariesPath = require('./getBuiltDictionariesPath.cjs');
57
56
  var import_getBuiltUnmergedDictionariesPath = require('./getBuiltUnmergedDictionariesPath.cjs');
57
+ var import_getFilteredLocalesContent = require('./getFilteredLocalesContent.cjs');
58
58
  var import_listDictionariesPath = require('./listDictionariesPath.cjs');
59
59
  var import_listGitFiles = require('./listGitFiles.cjs');
60
60
  var import_loadDictionaries = require('./loadDictionaries/index.cjs');
@@ -78,11 +78,11 @@ var import_writeContentDeclaration = require('./writeContentDeclaration/index.cj
78
78
  createModuleAugmentation,
79
79
  fetchDistantDictionaries,
80
80
  fetchDistantDictionaryKeys,
81
- filterDictionaryLocales,
82
81
  generateDictionaryListContent,
83
82
  getBuiltDictionariesPath,
84
83
  getBuiltUnmergedDictionariesPath,
85
84
  getFileHash,
85
+ getFilteredLocalesContent,
86
86
  handleAdditionalContentDeclarationFile,
87
87
  handleContentDeclarationFileChange,
88
88
  listDictionaries,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { checkDictionaryChanges } from './checkDictionaryChanges';\nexport {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeys } from './fetchDistantDictionaryKeys';\nexport { filterDictionaryLocales } from './filterDictionaryLocales';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n type DiffMode,\n type ListGitFilesOptions,\n} from './listGitFiles';\nexport {\n loadDictionaries,\n loadDistantDictionaries,\n loadLocalDictionaries,\n} from './loadDictionaries/index';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n} from './transpiler/dictionary_to_main';\nexport { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';\nexport { getFileHash } from './utils';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAuC;AACvC,qBAKO;AACP,4BAA+B;AAC/B,sCAAyC;AACzC,wCAA2C;AAC3C,qCAAwC;AACxC,sCAAyC;AACzC,8CAAiD;AACjD,kCAAiC;AACjC,0BAIO;AACP,8BAIO;AACP,+BAAkC;AAClC,uCAA0C;AAC1C,6BAAgC;AAChC,wCAA2C;AAC3C,qCAAwC;AACxC,4CAAgC;AAChC,gCAGO;AACP,sCAAyC;AACzC,mBAA4B;AAC5B,qCAGO;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { checkDictionaryChanges } from './checkDictionaryChanges';\nexport {\n buildAndWatchIntlayer,\n handleAdditionalContentDeclarationFile,\n handleContentDeclarationFileChange,\n watch,\n} from './chokidar/watcher';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { fetchDistantDictionaryKeys } from './fetchDistantDictionaryKeys';\nexport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nexport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\nexport { getFilteredLocalesContent } from './getFilteredLocalesContent';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n type DiffMode,\n type ListGitFilesOptions,\n} from './listGitFiles';\nexport {\n loadDictionaries,\n loadDistantDictionaries,\n loadLocalDictionaries,\n} from './loadDictionaries/index';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n} from './transpiler/dictionary_to_main';\nexport { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';\nexport { getFileHash } from './utils';\nexport {\n writeContentDeclaration,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAuC;AACvC,qBAKO;AACP,4BAA+B;AAC/B,sCAAyC;AACzC,wCAA2C;AAC3C,sCAAyC;AACzC,8CAAiD;AACjD,uCAA0C;AAC1C,kCAAiC;AACjC,0BAIO;AACP,8BAIO;AACP,+BAAkC;AAClC,uCAA0C;AAC1C,6BAAgC;AAChC,wCAA2C;AAC3C,qCAAwC;AACxC,4CAAgC;AAChC,gCAGO;AACP,sCAAyC;AACzC,mBAA4B;AAC5B,qCAGO;","names":[]}
@@ -38,8 +38,11 @@ const prepareIntlayer = async (configuration = (0, import_config.getConfiguratio
38
38
  configuration,
39
39
  projectRequire
40
40
  );
41
- const dictionariesPaths = await (0, import_declaration_file_to_dictionary.buildDictionary)(dictionaries, configuration);
42
- (0, import_dictionary_to_type.createTypes)(dictionariesPaths, configuration);
41
+ const dictionariesOutput = await (0, import_declaration_file_to_dictionary.buildDictionary)(dictionaries, configuration);
42
+ const dictionariesPaths = Object.values(
43
+ dictionariesOutput?.mergedDictionaries ?? {}
44
+ ).map((dictionary) => dictionary.dictionaryPath);
45
+ (0, import_dictionary_to_type.createTypes)(dictionariesPaths);
43
46
  (0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)(configuration);
44
47
  appLogger("Dictionaries built");
45
48
  (0, import_dictionary_to_type.createModuleAugmentation)(configuration);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n type IntlayerConfig,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nimport { createDictionaryEntryPoint } from './transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from './transpiler/dictionary_to_type/index';\nimport { writeConfiguration } from './writeConfiguration';\n\nexport const prepareIntlayer = async (\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire\n) => {\n const appLogger = getAppLogger(configuration);\n\n cleanOutputDir(configuration);\n\n const files: string[] = listDictionaries(configuration);\n\n const dictionaries = await loadDictionaries(\n files,\n configuration,\n projectRequire\n );\n\n // Build locale dictionaries\n const dictionariesPaths = await buildDictionary(dictionaries, configuration);\n\n createTypes(dictionariesPaths, configuration);\n\n createDictionaryEntryPoint(configuration);\n\n appLogger('Dictionaries built');\n\n createModuleAugmentation(configuration);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n writeConfiguration(configuration);\n\n appLogger('Configuration written', {\n isVerbose: true,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKO;AACP,4BAA+B;AAC/B,kCAAiC;AACjC,8BAAiC;AACjC,4CAAgC;AAChC,wCAA2C;AAC3C,gCAGO;AACP,gCAAmC;AAE5B,MAAM,kBAAkB,OAC7B,oBAAgC,gCAAiB,GACjD,iBAAiB,iCACd;AACH,QAAM,gBAAY,4BAAa,aAAa;AAE5C,4CAAe,aAAa;AAE5B,QAAM,YAAkB,8CAAiB,aAAa;AAEtD,QAAM,eAAe,UAAM;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGA,QAAM,oBAAoB,UAAM,uDAAgB,cAAc,aAAa;AAE3E,6CAAY,mBAAmB,aAAa;AAE5C,oEAA2B,aAAa;AAExC,YAAU,oBAAoB;AAE9B,0DAAyB,aAAa;AAEtC,YAAU,6BAA6B;AAAA,IACrC,WAAW;AAAA,EACb,CAAC;AAED,oDAAmB,aAAa;AAEhC,YAAU,yBAAyB;AAAA,IACjC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n type IntlayerConfig,\n getAppLogger,\n getConfiguration,\n} from '@intlayer/config';\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';\nimport { createDictionaryEntryPoint } from './transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from './transpiler/dictionary_to_type/index';\nimport { writeConfiguration } from './writeConfiguration';\n\nexport const prepareIntlayer = async (\n configuration: IntlayerConfig = getConfiguration(),\n projectRequire = ESMxCJSRequire\n) => {\n const appLogger = getAppLogger(configuration);\n\n cleanOutputDir(configuration);\n\n const files: string[] = listDictionaries(configuration);\n\n const dictionaries = await loadDictionaries(\n files,\n configuration,\n projectRequire\n );\n\n // Build locale dictionaries\n const dictionariesOutput = await buildDictionary(dictionaries, configuration);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n createTypes(dictionariesPaths);\n\n createDictionaryEntryPoint(configuration);\n\n appLogger('Dictionaries built');\n\n createModuleAugmentation(configuration);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n writeConfiguration(configuration);\n\n appLogger('Configuration written', {\n isVerbose: true,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKO;AACP,4BAA+B;AAC/B,kCAAiC;AACjC,8BAAiC;AACjC,4CAAgC;AAChC,wCAA2C;AAC3C,gCAGO;AACP,gCAAmC;AAE5B,MAAM,kBAAkB,OAC7B,oBAAgC,gCAAiB,GACjD,iBAAiB,iCACd;AACH,QAAM,gBAAY,4BAAa,aAAa;AAE5C,4CAAe,aAAa;AAE5B,QAAM,YAAkB,8CAAiB,aAAa;AAEtD,QAAM,eAAe,UAAM;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGA,QAAM,qBAAqB,UAAM,uDAAgB,cAAc,aAAa;AAE5E,QAAM,oBAAoB,OAAO;AAAA,IAC/B,oBAAoB,sBAAsB,CAAC;AAAA,EAC7C,EAAE,IAAI,CAAC,eAAe,WAAW,cAAc;AAE/C,6CAAY,iBAAiB;AAE7B,oEAA2B,aAAa;AAExC,YAAU,oBAAoB;AAE9B,0DAAyB,aAAa;AAEtC,YAAU,6BAA6B;AAAA,IACrC,WAAW;AAAA,EACb,CAAC;AAED,oDAAmB,aAAa;AAEhC,YAAU,yBAAyB;AAAA,IACjC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -32,7 +32,6 @@ const buildDictionary = async (dictionaries, configuration = (0, import_config.g
32
32
  if (dictionaryOutput.includes("intlayer")) {
33
33
  return await (0, import_intlayer_dictionary.buildIntlayerDictionary)(dictionaries, configuration);
34
34
  }
35
- return [];
36
35
  };
37
36
  // Annotate the CommonJS export names for ESM import in node:
38
37
  0 && (module.exports = {
@@ -1 +1 @@
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): Promise<string[]> => {\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 return [];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AAEjC,gCAAoC;AACpC,iCAAwC;AAEjC,MAAM,kBAAkB,OAC7B,cACA,oBAAgB,gCAAiB,MACX;AACtB,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;AAEA,SAAO,CAAC;AACV;","names":[]}
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":[]}
@@ -21,18 +21,29 @@ __export(buildIntlayerDictionary_exports, {
21
21
  buildIntlayerDictionary: () => buildIntlayerDictionary
22
22
  });
23
23
  module.exports = __toCommonJS(buildIntlayerDictionary_exports);
24
- var import_promises = require("fs/promises");
25
- var import_path = require("path");
26
24
  var import_config = require("@intlayer/config");
27
- var import_writeDictionary = require('./writeDictionary.cjs');
28
- const buildIntlayerDictionary = async (contentDeclarations, configuration = (0, import_config.getConfiguration)()) => {
29
- const { dictionariesDir } = configuration.content;
30
- await (0, import_promises.mkdir)((0, import_path.resolve)(dictionariesDir), { recursive: true });
31
- const dictionariesPaths = await (0, import_writeDictionary.writeDictionary)(
25
+ var import_writeDynamicDictionary = require('./writeDynamicDictionary.cjs');
26
+ var import_writeMergedDictionary = require('./writeMergedDictionary.cjs');
27
+ var import_writeUnmergedDictionary = require('./writeUnmergedDictionary.cjs');
28
+ const buildIntlayerDictionary = async (contentDeclarations, configuration = (0, import_config.getConfiguration)(), formats = ["cjs", "esm"]) => {
29
+ const unmergedDictionaries = await (0, import_writeUnmergedDictionary.writeUnmergedDictionaries)(
32
30
  contentDeclarations,
33
31
  configuration
34
32
  );
35
- return dictionariesPaths;
33
+ const mergedDictionaries = await (0, import_writeMergedDictionary.writeMergedDictionaries)(
34
+ unmergedDictionaries,
35
+ configuration
36
+ );
37
+ const dynamicDictionaries = await (0, import_writeDynamicDictionary.writeDynamicDictionary)(
38
+ mergedDictionaries,
39
+ configuration,
40
+ formats
41
+ );
42
+ return {
43
+ unmergedDictionaries,
44
+ mergedDictionaries,
45
+ dynamicDictionaries
46
+ };
36
47
  };
37
48
  // Annotate the CommonJS export names for ESM import in node:
38
49
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.ts"],"sourcesContent":["import { mkdir } from 'fs/promises';\nimport { resolve } from 'path';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { writeDictionary } from './writeDictionary';\n\n/**\n * This function transpile the bundled code to to make dictionaries as JSON files\n */\nexport const buildIntlayerDictionary = async (\n contentDeclarations: (DictionaryAPI | Dictionary)[],\n configuration = getConfiguration()\n) => {\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 dictionariesPaths: string[] = await writeDictionary(\n contentDeclarations as Dictionary[],\n configuration\n );\n\n return dictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAsB;AACtB,kBAAwB;AAGxB,oBAAiC;AAEjC,6BAAgC;AAKzB,MAAM,0BAA0B,OACrC,qBACA,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,gBAAgB,IAAI,cAAc;AAG1C,YAAM,2BAAM,qBAAQ,eAAe,GAAG,EAAE,WAAW,KAAK,CAAC;AAEzD,QAAM,oBAA8B,UAAM;AAAA,IACxC;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.ts"],"sourcesContent":["// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { writeDynamicDictionary } from './writeDynamicDictionary';\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 contentDeclarations: (DictionaryAPI | Dictionary)[],\n configuration = getConfiguration(),\n formats: ('cjs' | 'esm')[] = ['cjs', 'esm']\n) => {\n const unmergedDictionaries = await writeUnmergedDictionaries(\n contentDeclarations,\n configuration\n );\n\n const mergedDictionaries = await writeMergedDictionaries(\n unmergedDictionaries,\n configuration\n );\n\n const dynamicDictionaries = await writeDynamicDictionary(\n mergedDictionaries,\n configuration,\n formats\n );\n\n return {\n unmergedDictionaries,\n mergedDictionaries,\n dynamicDictionaries,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAAiC;AAEjC,oCAAuC;AACvC,mCAAwC;AACxC,qCAA0C;AAKnC,MAAM,0BAA0B,OACrC,qBACA,oBAAgB,gCAAiB,GACjC,UAA6B,CAAC,OAAO,KAAK,MACvC;AACH,QAAM,uBAAuB,UAAM;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,qBAAqB,UAAM;AAAA,IAC/B;AAAA,IACA;AAAA,EACF;AAEA,QAAM,sBAAsB,UAAM;AAAA,IAChC;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,30 @@
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
@@ -0,0 +1 @@
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":[]}
@@ -0,0 +1,107 @@
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 writeDynamicDictionary_exports = {};
20
+ __export(writeDynamicDictionary_exports, {
21
+ generateDictionaryEntryPoint: () => generateDictionaryEntryPoint,
22
+ writeDynamicDictionary: () => writeDynamicDictionary
23
+ });
24
+ module.exports = __toCommonJS(writeDynamicDictionary_exports);
25
+ var import_config = require("@intlayer/config");
26
+ var import_promises = require("fs/promises");
27
+ var import_path = require("path");
28
+ var import_getFilteredLocalesContent = require('../../../getFilteredLocalesContent.cjs');
29
+ var import_formatDictionaryText = require('./formatDictionaryText.cjs');
30
+ const generateDictionaryEntryPoint = (localedDictionariesPathsRecord, format = "esm", configuration = (0, import_config.getConfiguration)()) => {
31
+ const { dynamicDictionariesDir } = configuration.content;
32
+ let content = "";
33
+ const formattedDictionaryMap = Object.entries(
34
+ localedDictionariesPathsRecord
35
+ ).map(([locale, dictionary]) => {
36
+ const relativePath = (0, import_path.relative)(
37
+ dynamicDictionariesDir,
38
+ dictionary.dictionaryPath
39
+ );
40
+ if (format === "esm") {
41
+ return ` '${locale}': () => import('./${relativePath}', { assert: { type: 'json' }}).then(mod => mod.default)`;
42
+ }
43
+ return ` '${locale}': () => Promise.resolve(require('./${relativePath}.cjs'))`;
44
+ }).join(",\n");
45
+ content += `const content = {
46
+ ${formattedDictionaryMap}
47
+ };
48
+ `;
49
+ if (format === "esm") content += `export default content;
50
+ `;
51
+ if (format === "cjs") content += `module.exports = content;
52
+ `;
53
+ return content;
54
+ };
55
+ const writeDynamicDictionary = async (mergedDictionaries, configuration = (0, import_config.getConfiguration)(), formats = ["cjs", "esm"]) => {
56
+ const { locales } = configuration.internationalization;
57
+ const { dynamicDictionariesDir } = configuration.content;
58
+ await (0, import_promises.mkdir)((0, import_path.resolve)(dynamicDictionariesDir), { recursive: true });
59
+ let resultDictionariesPaths = {};
60
+ for await (const [key, dictionaryEntry] of Object.entries(
61
+ mergedDictionaries
62
+ )) {
63
+ if (key === "undefined") continue;
64
+ let localedDictionariesPathsRecord = {};
65
+ for await (const locale of locales) {
66
+ const localizedDictionary = {
67
+ ...dictionaryEntry.dictionary,
68
+ locale,
69
+ // @ts-expect-error - Fix Type instantiation is excessively deep and possibly infinite
70
+ content: (0, import_getFilteredLocalesContent.getFilteredLocalesContent)(
71
+ dictionaryEntry.dictionary.content,
72
+ locale
73
+ )
74
+ };
75
+ const contentString = (0, import_formatDictionaryText.formatDictionaryText)(localizedDictionary);
76
+ const outputFileName = `${key}.${locale}.json`;
77
+ const resultFilePath = (0, import_path.resolve)(dynamicDictionariesDir, outputFileName);
78
+ await (0, import_promises.writeFile)(resultFilePath, contentString, "utf8").catch((err) => {
79
+ console.error(`Error creating localized ${outputFileName}:`, err);
80
+ });
81
+ localedDictionariesPathsRecord[locale] = {
82
+ dictionaryPath: resultFilePath,
83
+ dictionary: localizedDictionary
84
+ };
85
+ }
86
+ resultDictionariesPaths[key] = localedDictionariesPathsRecord;
87
+ for await (const format of formats) {
88
+ const extension = format === "cjs" ? "cjs" : "mjs";
89
+ const content = generateDictionaryEntryPoint(
90
+ localedDictionariesPathsRecord,
91
+ format,
92
+ configuration
93
+ );
94
+ await (0, import_promises.writeFile)(
95
+ (0, import_path.resolve)(dynamicDictionariesDir, `${key}.${extension}`),
96
+ content
97
+ );
98
+ }
99
+ }
100
+ return resultDictionariesPaths;
101
+ };
102
+ // Annotate the CommonJS export names for ESM import in node:
103
+ 0 && (module.exports = {
104
+ generateDictionaryEntryPoint,
105
+ writeDynamicDictionary
106
+ });
107
+ //# sourceMappingURL=writeDynamicDictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.ts"],"sourcesContent":["import { getConfiguration, Locales } from '@intlayer/config';\nimport { type Dictionary } from '@intlayer/core';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { relative, resolve } from 'path';\nimport { getFilteredLocalesContent } from '../../../getFilteredLocalesContent';\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 = relative(\n dynamicDictionariesDir,\n 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/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 } = 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 for await (const [key, dictionaryEntry] of Object.entries(\n mergedDictionaries\n )) {\n if (key === 'undefined') continue;\n\n let localedDictionariesPathsRecord: LocalizedDictionaryResult = {};\n\n for await (const locale of locales) {\n const localizedDictionary = {\n ...dictionaryEntry.dictionary,\n locale,\n // @ts-expect-error - Fix Type instantiation is excessively deep and possibly infinite\n content: getFilteredLocalesContent(\n dictionaryEntry.dictionary.content as any,\n locale\n ),\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 for await (const format of formats) {\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 return resultDictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0C;AAE1C,sBAAiC;AACjC,kBAAkC;AAClC,uCAA0C;AAC1C,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,MACnB;AAAA,MACA,WAAW;AAAA,IACb;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,QAAQ,IAAI,cAAc;AAClC,QAAM,EAAE,uBAAuB,IAAI,cAAc;AAGjD,YAAM,2BAAM,qBAAQ,sBAAsB,GAAG,EAAE,WAAW,KAAK,CAAC;AAEhE,MAAI,0BAAqD,CAAC;AAG1D,mBAAiB,CAAC,KAAK,eAAe,KAAK,OAAO;AAAA,IAChD;AAAA,EACF,GAAG;AACD,QAAI,QAAQ,YAAa;AAEzB,QAAI,iCAA4D,CAAC;AAEjE,qBAAiB,UAAU,SAAS;AAClC,YAAM,sBAAsB;AAAA,QAC1B,GAAG,gBAAgB;AAAA,QACnB;AAAA;AAAA,QAEA,aAAS;AAAA,UACP,gBAAgB,WAAW;AAAA,UAC3B;AAAA,QACF;AAAA,MACF;AAEA,YAAM,oBAAgB,kDAAqB,mBAAmB;AAE9D,YAAM,iBAAiB,GAAG,GAAG,IAAI,MAAM;AACvC,YAAM,qBAAiB,qBAAQ,wBAAwB,cAAc;AAGrE,gBAAM,2BAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,gBAAQ,MAAM,4BAA4B,cAAc,KAAK,GAAG;AAAA,MAClE,CAAC;AAED,qCAA+B,MAAM,IAAI;AAAA,QACvC,gBAAgB;AAAA,QAChB,YAAY;AAAA,MACd;AAAA,IACF;AAEA,4BAAwB,GAAG,IAAI;AAE/B,qBAAiB,UAAU,SAAS;AAClC,YAAM,YAAY,WAAW,QAAQ,QAAQ;AAC7C,YAAM,UAAU;AAAA,QACd;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAEA,gBAAM;AAAA,YACJ,qBAAQ,wBAAwB,GAAG,GAAG,IAAI,SAAS,EAAE;AAAA,QACrD;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,59 @@
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 writeMergedDictionary_exports = {};
20
+ __export(writeMergedDictionary_exports, {
21
+ writeMergedDictionaries: () => writeMergedDictionaries
22
+ });
23
+ module.exports = __toCommonJS(writeMergedDictionary_exports);
24
+ var import_config = require("@intlayer/config");
25
+ var import_promises = require("fs/promises");
26
+ var import_path = require("path");
27
+ var import_mergeDictionaries = require('../../../mergeDictionaries.cjs');
28
+ var import_processPerLocaleDictionary = require('../../../processPerLocaleDictionary.cjs');
29
+ var import_formatDictionaryText = require('./formatDictionaryText.cjs');
30
+ const writeMergedDictionaries = async (groupedDictionaries, configuration = (0, import_config.getConfiguration)()) => {
31
+ const { dictionariesDir } = configuration.content;
32
+ await (0, import_promises.mkdir)((0, import_path.resolve)(dictionariesDir), { recursive: true });
33
+ let resultDictionariesPaths = {};
34
+ for await (const [key, dictionariesEntry] of Object.entries(
35
+ groupedDictionaries
36
+ )) {
37
+ if (key === "undefined") continue;
38
+ const multiLocaleDictionaries = dictionariesEntry.dictionaries.map(
39
+ (dictionary) => (0, import_processPerLocaleDictionary.processPerLocaleDictionary)(dictionary)
40
+ );
41
+ const mergedDictionary = (0, import_mergeDictionaries.mergeDictionaries)(multiLocaleDictionaries);
42
+ const contentString = (0, import_formatDictionaryText.formatDictionaryText)(mergedDictionary);
43
+ const outputFileName = `${key}.json`;
44
+ const resultFilePath = (0, import_path.resolve)(dictionariesDir, outputFileName);
45
+ await (0, import_promises.writeFile)(resultFilePath, contentString, "utf8").catch((err) => {
46
+ console.error(`Error creating merged ${outputFileName}:`, err);
47
+ });
48
+ resultDictionariesPaths[key] = {
49
+ dictionaryPath: resultFilePath,
50
+ dictionary: mergedDictionary
51
+ };
52
+ }
53
+ return resultDictionariesPaths;
54
+ };
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ writeMergedDictionaries
58
+ });
59
+ //# sourceMappingURL=writeMergedDictionary.cjs.map
@@ -0,0 +1 @@
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 { 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/dictionaries/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 let resultDictionariesPaths: MergedDictionaryOutput = {};\n\n // Merge dictionaries with the same key and write to dictionariesDir\n for await (const [key, dictionariesEntry] of Object.entries(\n groupedDictionaries\n )) {\n if (key === 'undefined') continue;\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 resultDictionariesPaths[key] = {\n dictionaryPath: resultFilePath,\n dictionary: mergedDictionary,\n };\n }\n\n return resultDictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AAEjC,sBAAiC;AACjC,kBAAwB;AACxB,+BAAkC;AAClC,wCAA2C;AAC3C,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,MAAI,0BAAkD,CAAC;AAGvD,mBAAiB,CAAC,KAAK,iBAAiB,KAAK,OAAO;AAAA,IAClD;AAAA,EACF,GAAG;AACD,QAAI,QAAQ,YAAa;AAEzB,UAAM,0BAA0B,kBAAkB,aAAa;AAAA,MAC7D,CAAC,mBAAe,8DAA2B,UAAU;AAAA,IACvD;AAEA,UAAM,uBAAmB,4CAAkB,uBAAuB;AAElE,UAAM,oBAAgB,kDAAqB,gBAAgB;AAE3D,UAAM,iBAAiB,GAAG,GAAG;AAC7B,UAAM,qBAAiB,qBAAQ,iBAAiB,cAAc;AAG9D,cAAM,2BAAU,gBAAgB,eAAe,MAAM,EAAE,MAAM,CAAC,QAAQ;AACpE,cAAQ,MAAM,yBAAyB,cAAc,KAAK,GAAG;AAAA,IAC/D,CAAC;AAED,4BAAwB,GAAG,IAAI;AAAA,MAC7B,gBAAgB;AAAA,MAChB,YAAY;AAAA,IACd;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}