@intlayer/chokidar 6.0.0-canary.3 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/chokidar/watcher.cjs +4 -4
- package/dist/cjs/chokidar/watcher.cjs.map +1 -1
- package/dist/cjs/fetchDistantDictionaries.cjs +3 -25
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/index.cjs +2 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +19 -21
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +13 -4
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/log.cjs +47 -12
- package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +52 -9
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs +5 -1
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +1 -1
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs +3 -1
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs.map +1 -1
- package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/buildIntlayerDictionary.cjs +3 -3
- package/dist/cjs/transpiler/intlayer_dictionary/buildIntlayerDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/index.cjs +3 -3
- package/dist/cjs/transpiler/intlayer_dictionary/index.cjs.map +1 -0
- package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/processContentDeclaration.cjs +1 -1
- package/dist/cjs/transpiler/intlayer_dictionary/processContentDeclaration.cjs.map +1 -0
- package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeDynamicDictionary.cjs +19 -10
- package/dist/cjs/transpiler/intlayer_dictionary/writeDynamicDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeFetchDictionary.cjs +9 -3
- package/dist/cjs/transpiler/intlayer_dictionary/writeFetchDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeMergedDictionary.cjs +12 -8
- package/dist/cjs/transpiler/intlayer_dictionary/writeMergedDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeRemoteDictionary.cjs +9 -7
- package/dist/cjs/transpiler/intlayer_dictionary/writeRemoteDictionary.cjs.map +1 -0
- package/dist/cjs/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeUnmergedDictionary.cjs +12 -8
- package/dist/cjs/transpiler/intlayer_dictionary/writeUnmergedDictionary.cjs.map +1 -0
- package/dist/cjs/writeConfiguration/index.cjs +5 -6
- package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +1 -5
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/cjs/writeFileIfChanged.cjs +46 -0
- package/dist/cjs/writeFileIfChanged.cjs.map +1 -0
- package/dist/cjs/{transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.cjs → writeJsonIfChanged.cjs} +11 -14
- package/dist/cjs/writeJsonIfChanged.cjs.map +1 -0
- package/dist/esm/chokidar/watcher.mjs +1 -1
- package/dist/esm/chokidar/watcher.mjs.map +1 -1
- package/dist/esm/fetchDistantDictionaries.mjs +5 -32
- package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +1 -1
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +19 -21
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +14 -5
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/log.mjs +50 -13
- package/dist/esm/loadDictionaries/log.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +53 -8
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs +6 -2
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +1 -1
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs +4 -2
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs.map +1 -1
- package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/buildIntlayerDictionary.mjs +2 -2
- package/dist/esm/transpiler/intlayer_dictionary/buildIntlayerDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/index.mjs +1 -1
- package/dist/esm/transpiler/intlayer_dictionary/index.mjs.map +1 -0
- package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/processContentDeclaration.mjs +1 -1
- package/dist/esm/transpiler/intlayer_dictionary/processContentDeclaration.mjs.map +1 -0
- package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeDynamicDictionary.mjs +25 -12
- package/dist/esm/transpiler/intlayer_dictionary/writeDynamicDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeFetchDictionary.mjs +15 -5
- package/dist/esm/transpiler/intlayer_dictionary/writeFetchDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeMergedDictionary.mjs +14 -10
- package/dist/esm/transpiler/intlayer_dictionary/writeMergedDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeRemoteDictionary.mjs +11 -9
- package/dist/esm/transpiler/intlayer_dictionary/writeRemoteDictionary.mjs.map +1 -0
- package/dist/esm/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeUnmergedDictionary.mjs +14 -10
- package/dist/esm/transpiler/intlayer_dictionary/writeUnmergedDictionary.mjs.map +1 -0
- package/dist/esm/writeConfiguration/index.mjs +5 -6
- package/dist/esm/writeConfiguration/index.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +1 -5
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/esm/writeFileIfChanged.mjs +22 -0
- package/dist/esm/writeFileIfChanged.mjs.map +1 -0
- package/dist/esm/writeJsonIfChanged.mjs +10 -0
- package/dist/esm/writeJsonIfChanged.mjs.map +1 -0
- package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadDictionaries.d.ts +4 -0
- package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +5 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/log.d.ts +7 -0
- package/dist/types/loadDictionaries/log.d.ts.map +1 -1
- package/dist/types/prepareIntlayer.d.ts.map +1 -1
- package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +1 -1
- package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts.map +1 -1
- package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/buildIntlayerDictionary.d.ts +1 -1
- package/dist/types/transpiler/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/index.d.ts +1 -1
- package/dist/types/transpiler/intlayer_dictionary/index.d.ts.map +1 -0
- package/dist/types/transpiler/intlayer_dictionary/processContentDeclaration.d.ts.map +1 -0
- package/dist/types/transpiler/intlayer_dictionary/writeDynamicDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/intlayer_dictionary/writeFetchDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/intlayer_dictionary/writeMergedDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/intlayer_dictionary/writeRemoteDictionary.d.ts.map +1 -0
- package/dist/types/transpiler/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +1 -0
- package/dist/types/writeConfiguration/index.d.ts +1 -1
- package/dist/types/writeConfiguration/index.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
- package/dist/types/writeFileIfChanged.d.ts +4 -0
- package/dist/types/writeFileIfChanged.d.ts.map +1 -0
- package/dist/types/writeJsonIfChanged.d.ts +4 -0
- package/dist/types/writeJsonIfChanged.d.ts.map +1 -0
- package/package.json +15 -15
- package/dist/cjs/fetchDistantDictionaryKeysAndUpdateTimestamp.cjs +0 -45
- package/dist/cjs/fetchDistantDictionaryKeysAndUpdateTimestamp.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.cjs +0 -46
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.cjs +0 -103
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.cjs +0 -23
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.cjs +0 -51
- package/dist/cjs/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs +0 -40
- package/dist/cjs/transpiler/declaration_file_to_dictionary/index.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.cjs +0 -30
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/index.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.cjs +0 -52
- package/dist/cjs/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.cjs.map +0 -1
- package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs +0 -21
- package/dist/esm/fetchDistantDictionaryKeysAndUpdateTimestamp.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.mjs +0 -24
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.mjs +0 -81
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.mjs +0 -13
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.mjs +0 -2
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.mjs +0 -27
- package/dist/esm/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs +0 -16
- package/dist/esm/transpiler/declaration_file_to_dictionary/index.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.mjs +0 -6
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/index.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.mjs +0 -28
- package/dist/esm/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.mjs.map +0 -1
- package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts +0 -3
- package/dist/types/fetchDistantDictionaryKeysAndUpdateTimestamp.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.d.ts +0 -6
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/buildI18nextDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.d.ts +0 -7
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertContentDeclarationInto18nDictionaries.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.d.ts +0 -2
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/convertPluralsValues.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.d.ts +0 -2
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/index.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.d.ts +0 -7
- package/dist/types/transpiler/declaration_file_to_dictionary/i18next_dictionary/writeDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts +0 -8
- package/dist/types/transpiler/declaration_file_to_dictionary/index.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.d.ts +0 -2
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/formatDictionaryText.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/index.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/processContentDeclaration.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeDynamicDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeFetchDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeMergedDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeRemoteDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.d.ts +0 -7
- package/dist/types/transpiler/declaration_file_to_dictionary/reactIntl_dictionary/writeDictionary.d.ts.map +0 -1
- /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/processContentDeclaration.d.ts +0 -0
- /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeDynamicDictionary.d.ts +0 -0
- /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeFetchDictionary.d.ts +0 -0
- /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeMergedDictionary.d.ts +0 -0
- /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeRemoteDictionary.d.ts +0 -0
- /package/dist/types/transpiler/{declaration_file_to_dictionary/intlayer_dictionary → intlayer_dictionary}/writeUnmergedDictionary.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/transpiler/intlayer_dictionary/writeMergedDictionary.ts"],"sourcesContent":["import { colorizePath, getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { mkdir } from 'fs/promises';\nimport { resolve } from 'path';\nimport { mergeDictionaries } from '../../mergeDictionaries';\nimport { processPerLocaleDictionary } from '../../processPerLocaleDictionary';\nimport { parallelize } from '../../utils/parallelize';\nimport { writeJsonIfChanged } from '../../writeJsonIfChanged';\nimport { UnmergedDictionaryOutput } from './writeUnmergedDictionary';\n\nexport type MergedDictionaryResult = {\n dictionaryPath: string;\n dictionary: Dictionary;\n};\n\nexport type MergedDictionaryOutput = Record<string, MergedDictionaryResult>;\n\n/**\n * Write the merged dictionaries to the dictionariesDir\n * @param groupedDictionaries - The grouped dictionaries\n * @param configuration - The configuration\n * @returns The merged dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/dictionary/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeMergedDictionaries = async (\n groupedDictionaries: UnmergedDictionaryOutput,\n configuration = getConfiguration()\n): Promise<MergedDictionaryOutput> => {\n const { dictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dictionariesDir), { recursive: true });\n\n const results = await parallelize(\n Object.entries(groupedDictionaries),\n async ([key, dictionariesEntry]) => {\n if (key === 'undefined') {\n return undefined as unknown as readonly [\n string,\n MergedDictionaryResult,\n ];\n }\n\n const multiLocaleDictionaries = dictionariesEntry.dictionaries.map(\n (dictionary) => processPerLocaleDictionary(dictionary)\n );\n\n const mergedDictionary = mergeDictionaries(multiLocaleDictionaries);\n\n const outputFileName = `${key}.json`;\n const resultFilePath = resolve(dictionariesDir, outputFileName);\n\n // Write the merged dictionary\n await writeJsonIfChanged(resultFilePath, mergedDictionary).catch(\n (err) => {\n console.error(\n `Error creating merged ${colorizePath(resultFilePath)}:`,\n err\n );\n }\n );\n\n return [\n key,\n {\n dictionaryPath: resultFilePath,\n dictionary: mergedDictionary,\n } as MergedDictionaryResult,\n ] as const;\n }\n );\n\n return Object.fromEntries(\n results.filter(Boolean) as Array<readonly [string, MergedDictionaryResult]>\n );\n};\n"],"mappings":"AAAA,SAAS,cAAc,wBAAwB;AAE/C,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,yBAAyB;AAClC,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AA0B5B,MAAM,0BAA0B,OACrC,qBACA,gBAAgB,iBAAiB,MACG;AACpC,QAAM,EAAE,gBAAgB,IAAI,cAAc;AAG1C,QAAM,MAAM,QAAQ,eAAe,GAAG,EAAE,WAAW,KAAK,CAAC;AAEzD,QAAM,UAAU,MAAM;AAAA,IACpB,OAAO,QAAQ,mBAAmB;AAAA,IAClC,OAAO,CAAC,KAAK,iBAAiB,MAAM;AAClC,UAAI,QAAQ,aAAa;AACvB,eAAO;AAAA,MAIT;AAEA,YAAM,0BAA0B,kBAAkB,aAAa;AAAA,QAC7D,CAAC,eAAe,2BAA2B,UAAU;AAAA,MACvD;AAEA,YAAM,mBAAmB,kBAAkB,uBAAuB;AAElE,YAAM,iBAAiB,GAAG,GAAG;AAC7B,YAAM,iBAAiB,QAAQ,iBAAiB,cAAc;AAG9D,YAAM,mBAAmB,gBAAgB,gBAAgB,EAAE;AAAA,QACzD,CAAC,QAAQ;AACP,kBAAQ;AAAA,YACN,yBAAyB,aAAa,cAAc,CAAC;AAAA,YACrD;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,aAAO;AAAA,QACL;AAAA,QACA;AAAA,UACE,gBAAgB;AAAA,UAChB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO;AAAA,IACZ,QAAQ,OAAO,OAAO;AAAA,EACxB;AACF;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getConfiguration } from "@intlayer/config";
|
|
2
|
-
import { mkdir
|
|
1
|
+
import { colorizePath, getConfiguration } from "@intlayer/config";
|
|
2
|
+
import { mkdir } from "fs/promises";
|
|
3
3
|
import { resolve } from "path";
|
|
4
|
-
import { filterInvalidDictionaries } from "
|
|
5
|
-
import { formatDistantDictionaries } from "
|
|
6
|
-
import { parallelize } from "
|
|
7
|
-
import {
|
|
4
|
+
import { filterInvalidDictionaries } from "../../filterInvalidDictionaries.mjs";
|
|
5
|
+
import { formatDistantDictionaries } from "../../loadDictionaries/index.mjs";
|
|
6
|
+
import { parallelize } from "../../utils/parallelize.mjs";
|
|
7
|
+
import { writeJsonIfChanged } from "../../writeJsonIfChanged.mjs";
|
|
8
8
|
const writeRemoteDictionary = async (remoteDictionaries, configuration = getConfiguration()) => {
|
|
9
9
|
const { remoteDictionariesDir } = configuration.content;
|
|
10
10
|
await mkdir(resolve(remoteDictionariesDir), { recursive: true });
|
|
@@ -14,9 +14,11 @@ const writeRemoteDictionary = async (remoteDictionaries, configuration = getConf
|
|
|
14
14
|
async (dictionary) => {
|
|
15
15
|
const outputFileName = `${dictionary.key}.json`;
|
|
16
16
|
const resultFilePath = resolve(remoteDictionariesDir, outputFileName);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
await writeJsonIfChanged(resultFilePath, dictionary).catch((err) => {
|
|
18
|
+
console.error(
|
|
19
|
+
`Error creating merged ${colorizePath(resultFilePath)}:`,
|
|
20
|
+
err
|
|
21
|
+
);
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/transpiler/intlayer_dictionary/writeRemoteDictionary.ts"],"sourcesContent":["import { colorizePath, getConfiguration } from '@intlayer/config';\nimport { Dictionary } from '@intlayer/core';\nimport { mkdir } from 'fs/promises';\nimport { resolve } from 'path';\nimport { filterInvalidDictionaries } from '../../filterInvalidDictionaries';\nimport { formatDistantDictionaries } from '../../loadDictionaries';\nimport { parallelize } from '../../utils/parallelize';\nimport { writeJsonIfChanged } from '../../writeJsonIfChanged';\n\n/**\n * Write the localized dictionaries to the dictionariesDir\n * @param mergedDictionaries - The merged dictionaries\n * @param configuration - The configuration\n * @returns The final dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/fetch_dictionaries/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeRemoteDictionary = async (\n remoteDictionaries: Dictionary[],\n configuration = getConfiguration()\n): Promise<Dictionary[]> => {\n const { remoteDictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(remoteDictionariesDir), { recursive: true });\n\n const filteredDictionaries = filterInvalidDictionaries(remoteDictionaries);\n\n // Merge dictionaries with the same key and write to dictionariesDir\n await parallelize(\n filteredDictionaries.filter((dictionary) => dictionary.key !== 'undefined'),\n async (dictionary) => {\n const outputFileName = `${dictionary.key}.json`;\n const resultFilePath = resolve(remoteDictionariesDir, outputFileName);\n\n // Write the merged dictionary\n await writeJsonIfChanged(resultFilePath, dictionary).catch((err) => {\n console.error(\n `Error creating merged ${colorizePath(resultFilePath)}:`,\n err\n );\n });\n }\n );\n\n return formatDistantDictionaries(remoteDictionaries);\n};\n"],"mappings":"AAAA,SAAS,cAAc,wBAAwB;AAE/C,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,iCAAiC;AAC1C,SAAS,iCAAiC;AAC1C,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AAkB5B,MAAM,wBAAwB,OACnC,oBACA,gBAAgB,iBAAiB,MACP;AAC1B,QAAM,EAAE,sBAAsB,IAAI,cAAc;AAGhD,QAAM,MAAM,QAAQ,qBAAqB,GAAG,EAAE,WAAW,KAAK,CAAC;AAE/D,QAAM,uBAAuB,0BAA0B,kBAAkB;AAGzE,QAAM;AAAA,IACJ,qBAAqB,OAAO,CAAC,eAAe,WAAW,QAAQ,WAAW;AAAA,IAC1E,OAAO,eAAe;AACpB,YAAM,iBAAiB,GAAG,WAAW,GAAG;AACxC,YAAM,iBAAiB,QAAQ,uBAAuB,cAAc;AAGpE,YAAM,mBAAmB,gBAAgB,UAAU,EAAE,MAAM,CAAC,QAAQ;AAClE,gBAAQ;AAAA,UACN,yBAAyB,aAAa,cAAc,CAAC;AAAA,UACrD;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO,0BAA0B,kBAAkB;AACrD;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getConfiguration, x } from "@intlayer/config";
|
|
2
|
-
import { mkdir
|
|
1
|
+
import { colorizePath, getConfiguration, x } from "@intlayer/config";
|
|
2
|
+
import { mkdir } from "fs/promises";
|
|
3
3
|
import { resolve } from "path";
|
|
4
|
-
import { filterInvalidDictionaries } from "
|
|
5
|
-
import { orderDictionaries } from "
|
|
6
|
-
import { parallelize } from "
|
|
7
|
-
import {
|
|
4
|
+
import { filterInvalidDictionaries } from "../../filterInvalidDictionaries.mjs";
|
|
5
|
+
import { orderDictionaries } from "../../orderDictionaries.mjs";
|
|
6
|
+
import { parallelize } from "../../utils/parallelize.mjs";
|
|
7
|
+
import { writeJsonIfChanged } from "../../writeJsonIfChanged.mjs";
|
|
8
8
|
const groupDictionariesByKey = (dictionaries) => dictionaries.reduce(
|
|
9
9
|
(acc, dictionary) => {
|
|
10
10
|
const key = dictionary.key;
|
|
@@ -31,12 +31,16 @@ const writeUnmergedDictionaries = async (dictionaries, configuration = getConfig
|
|
|
31
31
|
dictionaries2,
|
|
32
32
|
configuration
|
|
33
33
|
);
|
|
34
|
-
const contentString = formatDictionaryText(orderedDictionaries);
|
|
35
34
|
const outputFileName = `${key}.json`;
|
|
36
35
|
const unmergedFilePath = resolve(unmergedDictionariesDir, outputFileName);
|
|
37
|
-
await
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
await writeJsonIfChanged(unmergedFilePath, orderedDictionaries).catch(
|
|
37
|
+
(err) => {
|
|
38
|
+
console.error(
|
|
39
|
+
`${x} Error creating unmerged ${colorizePath(unmergedFilePath)}:`,
|
|
40
|
+
err
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
40
44
|
return [
|
|
41
45
|
key,
|
|
42
46
|
{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/transpiler/intlayer_dictionary/writeUnmergedDictionary.ts"],"sourcesContent":["import { colorizePath, getConfiguration, x } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { mkdir } from 'fs/promises';\nimport { resolve } from 'path';\nimport { filterInvalidDictionaries } from '../../filterInvalidDictionaries';\nimport { orderDictionaries } from '../../orderDictionaries';\nimport { parallelize } from '../../utils/parallelize';\nimport { writeJsonIfChanged } from '../../writeJsonIfChanged';\n\nconst groupDictionariesByKey = (\n dictionaries: Dictionary[]\n): Record<string, Dictionary[]> =>\n dictionaries.reduce(\n (acc, dictionary) => {\n const key = dictionary.key;\n if (!acc[key]) {\n acc[key] = [];\n }\n acc[key].push(dictionary);\n return acc;\n },\n {} as Record<string, Dictionary[]>\n );\n\nexport type UnmergedDictionaryResult = {\n dictionaryPath: string;\n dictionaries: Dictionary[];\n};\n\nexport type UnmergedDictionaryOutput = Record<string, UnmergedDictionaryResult>;\n\n/**\n * Write the unmerged dictionaries to the unmergedDictionariesDir\n * @param dictionaries - The dictionaries to write\n * @param configuration - The configuration\n * @returns The grouped dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * console.log(unmergedDictionaries);\n *\n * // .intlayer/unmerged_dictionaries/home.json\n * // {\n * // [\n * // { key: 'home', content: { ... } },\n * // { key: 'home', content: { ... } },\n * // ],\n * // }\n * ```\n */\nexport const writeUnmergedDictionaries = async (\n dictionaries: Dictionary[],\n configuration = getConfiguration()\n): Promise<UnmergedDictionaryOutput> => {\n const { unmergedDictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(unmergedDictionariesDir), { recursive: true });\n\n const filteredDictionaries = filterInvalidDictionaries(dictionaries);\n\n // Group dictionaries by key and write to unmergedDictionariesDir\n const groupedDictionaries = groupDictionariesByKey(filteredDictionaries);\n\n const results = await parallelize(\n Object.entries(groupedDictionaries),\n async ([key, dictionaries]) => {\n if (key === 'undefined') {\n return undefined as unknown as readonly [\n string,\n UnmergedDictionaryResult,\n ];\n }\n\n const orderedDictionaries = orderDictionaries(\n dictionaries,\n configuration\n );\n\n const outputFileName = `${key}.json`;\n const unmergedFilePath = resolve(unmergedDictionariesDir, outputFileName);\n\n // Write the grouped dictionaries\n await writeJsonIfChanged(unmergedFilePath, orderedDictionaries).catch(\n (err) => {\n console.error(\n `${x} Error creating unmerged ${colorizePath(unmergedFilePath)}:`,\n err\n );\n }\n );\n\n return [\n key,\n {\n dictionaryPath: unmergedFilePath,\n dictionaries: dictionaries,\n } as UnmergedDictionaryResult,\n ] as const;\n }\n );\n\n return Object.fromEntries(\n results.filter(Boolean) as Array<\n readonly [string, UnmergedDictionaryResult]\n >\n );\n};\n"],"mappings":"AAAA,SAAS,cAAc,kBAAkB,SAAS;AAElD,SAAS,aAAa;AACtB,SAAS,eAAe;AACxB,SAAS,iCAAiC;AAC1C,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AAEnC,MAAM,yBAAyB,CAC7B,iBAEA,aAAa;AAAA,EACX,CAAC,KAAK,eAAe;AACnB,UAAM,MAAM,WAAW;AACvB,QAAI,CAAC,IAAI,GAAG,GAAG;AACb,UAAI,GAAG,IAAI,CAAC;AAAA,IACd;AACA,QAAI,GAAG,EAAE,KAAK,UAAU;AACxB,WAAO;AAAA,EACT;AAAA,EACA,CAAC;AACH;AA6BK,MAAM,4BAA4B,OACvC,cACA,gBAAgB,iBAAiB,MACK;AACtC,QAAM,EAAE,wBAAwB,IAAI,cAAc;AAGlD,QAAM,MAAM,QAAQ,uBAAuB,GAAG,EAAE,WAAW,KAAK,CAAC;AAEjE,QAAM,uBAAuB,0BAA0B,YAAY;AAGnE,QAAM,sBAAsB,uBAAuB,oBAAoB;AAEvE,QAAM,UAAU,MAAM;AAAA,IACpB,OAAO,QAAQ,mBAAmB;AAAA,IAClC,OAAO,CAAC,KAAKA,aAAY,MAAM;AAC7B,UAAI,QAAQ,aAAa;AACvB,eAAO;AAAA,MAIT;AAEA,YAAM,sBAAsB;AAAA,QAC1BA;AAAA,QACA;AAAA,MACF;AAEA,YAAM,iBAAiB,GAAG,GAAG;AAC7B,YAAM,mBAAmB,QAAQ,yBAAyB,cAAc;AAGxE,YAAM,mBAAmB,kBAAkB,mBAAmB,EAAE;AAAA,QAC9D,CAAC,QAAQ;AACP,kBAAQ;AAAA,YACN,GAAG,CAAC,4BAA4B,aAAa,gBAAgB,CAAC;AAAA,YAC9D;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,aAAO;AAAA,QACL;AAAA,QACA;AAAA,UACE,gBAAgB;AAAA,UAChB,cAAcA;AAAA,QAChB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,OAAO;AAAA,IACZ,QAAQ,OAAO,OAAO;AAAA,EAGxB;AACF;","names":["dictionaries"]}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mkdir } from "fs/promises";
|
|
2
2
|
import { join } from "path";
|
|
3
|
-
|
|
3
|
+
import { writeJsonIfChanged } from "../writeJsonIfChanged.mjs";
|
|
4
|
+
const writeConfiguration = async (configuration) => {
|
|
4
5
|
const { content } = configuration;
|
|
5
6
|
const { configDir } = content;
|
|
6
|
-
|
|
7
|
-
mkdirSync(configDir, { recursive: true });
|
|
8
|
-
}
|
|
7
|
+
await mkdir(configDir, { recursive: true });
|
|
9
8
|
const configFilePath = join(configDir, "configuration.json");
|
|
10
|
-
|
|
9
|
+
await writeJsonIfChanged(configFilePath, configuration);
|
|
11
10
|
};
|
|
12
11
|
export {
|
|
13
12
|
writeConfiguration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/writeConfiguration/index.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/config';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/writeConfiguration/index.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/config';\nimport { mkdir } from 'fs/promises';\nimport { join } from 'path';\nimport { writeJsonIfChanged } from '../writeJsonIfChanged';\n\nexport const writeConfiguration = async (configuration: IntlayerConfig) => {\n const { content } = configuration;\n const { configDir } = content;\n\n // Ensure target directory exists\n // configDir is expected to be the directory where configuration.json will live\n await mkdir(configDir, { recursive: true });\n\n const configFilePath = join(configDir, 'configuration.json');\n\n await writeJsonIfChanged(configFilePath, configuration);\n};\n"],"mappings":"AACA,SAAS,aAAa;AACtB,SAAS,YAAY;AACrB,SAAS,0BAA0B;AAE5B,MAAM,qBAAqB,OAAO,kBAAkC;AACzE,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,EAAE,UAAU,IAAI;AAItB,QAAM,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;AAE1C,QAAM,iBAAiB,KAAK,WAAW,oBAAoB;AAE3D,QAAM,mBAAmB,gBAAgB,aAAa;AACxD;","names":[]}
|
|
@@ -2,7 +2,6 @@ import configuration from "@intlayer/config/built";
|
|
|
2
2
|
import { colorizePath, x } from "@intlayer/config/client";
|
|
3
3
|
import dictionariesRecord from "@intlayer/unmerged-dictionaries-entry";
|
|
4
4
|
import deepEqual from "deep-equal";
|
|
5
|
-
import { existsSync } from "fs";
|
|
6
5
|
import { mkdir, writeFile } from "fs/promises";
|
|
7
6
|
import { dirname, extname } from "path";
|
|
8
7
|
import { prepareContentDeclaration } from "../prepareContentDeclaration.mjs";
|
|
@@ -62,10 +61,7 @@ const writeContentDeclaration = async (dictionary, config = configuration, newDi
|
|
|
62
61
|
const writeFileWithDirectories = async (filePath, data) => {
|
|
63
62
|
try {
|
|
64
63
|
const dir = dirname(filePath);
|
|
65
|
-
|
|
66
|
-
if (!directoryExists) {
|
|
67
|
-
await mkdir(dir, { recursive: true });
|
|
68
|
-
}
|
|
64
|
+
await mkdir(dir, { recursive: true });
|
|
69
65
|
const extention = extname(filePath);
|
|
70
66
|
const acceptedExtensions = configuration.content.fileExtensions.map(
|
|
71
67
|
(extention2) => extname(extention2)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizePath, x, 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 {
|
|
1
|
+
{"version":3,"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizePath, x, 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 { 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: 'new content file',\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 // Create the directory recursively\n await mkdir(dir, { recursive: true });\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 console.error(data);\n\n throw new Error(\n `${x} Error writing file to ${colorizePath(filePath)}: ${error}`\n );\n }\n};\n"],"mappings":"AAAA,OAAO,mBAAmB;AAC1B,SAAS,cAAc,SAA8B;AAErD,OAAO,wBAAwB;AAC/B,OAAO,eAAe;AACtB,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,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,qBACJ,mBAAmB,WAAW,GAAG,EACjC,OAAO,CAAC,OAAO,GAAG,aAAa,WAAW,QAAQ;AAEpD,QAAM,WAAW,WAAW;AAC5B,QAAM,8BACJ,MAAM,yBAAyB,UAAU;AAE3C,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,yBAAyB,UAAU,2BAA2B;AAEpE,eAAO,EAAE,QAAQ,WAAW,MAAM,SAAS;AAAA,MAC7C,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,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AAEpC,UAAM,YAAY,QAAQ,QAAQ;AAClC,UAAM,qBAAqB,cAAc,QAAQ,eAAe;AAAA,MAC9D,CAACA,eAAc,QAAQA,UAAS;AAAA,IAClC;AAEA,QAAI,CAAC,mBAAmB,SAAS,SAAS,GAAG;AAC3C,YAAM,IAAI;AAAA,QACR,2BAA2B,SAAS,WAAW,QAAQ;AAAA,MACzD;AAAA,IACF;AAEA,QAAI,cAAc,SAAS;AACzB,YAAM,iBAAiB,KAAK,UAAU,MAAM,MAAM,CAAC;AAGnD,YAAM,UAAU,UAAU,cAAc;AAAA,IAC1C,OAAO;AACL,YAAM,YAAY,UAAU,IAA6B;AAAA,IAC3D;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,IAAI;AAElB,UAAM,IAAI;AAAA,MACR,GAAG,CAAC,0BAA0B,aAAa,QAAQ,CAAC,KAAK,KAAK;AAAA,IAChE;AAAA,EACF;AACF;","names":["extention"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createReadStream } from "node:fs";
|
|
3
|
+
import { writeFile } from "node:fs/promises";
|
|
4
|
+
const hashFile = async (path) => {
|
|
5
|
+
const h = createHash("sha256");
|
|
6
|
+
const rs = createReadStream(path);
|
|
7
|
+
rs.on("data", (chunk) => h.update(chunk));
|
|
8
|
+
await new Promise((res, rej) => {
|
|
9
|
+
rs.on("end", () => res());
|
|
10
|
+
rs.on("error", rej);
|
|
11
|
+
});
|
|
12
|
+
return h.digest("hex");
|
|
13
|
+
};
|
|
14
|
+
const isReadableStream = (value) => !!value && typeof value === "object" && typeof value.pipe === "function";
|
|
15
|
+
const writeFileIfChanged = async (path, dataOrStream, { encoding = "utf8" } = {}) => {
|
|
16
|
+
await writeFile(path, dataOrStream, { encoding });
|
|
17
|
+
return true;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
writeFileIfChanged
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=writeFileIfChanged.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/writeFileIfChanged.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { createReadStream } from 'node:fs';\nimport { writeFile } from 'node:fs/promises';\nimport { Readable } from 'node:stream';\n\nconst hashFile = async (path: string) => {\n const h = createHash('sha256');\n const rs = createReadStream(path);\n rs.on('data', (chunk) => h.update(chunk));\n await new Promise<void>((res, rej) => {\n rs.on('end', () => res());\n rs.on('error', rej);\n });\n return h.digest('hex');\n};\n\nconst isReadableStream = (value: unknown): value is Readable =>\n !!value &&\n typeof value === 'object' &&\n typeof (value as any).pipe === 'function';\n\nexport const writeFileIfChanged = async (\n path: string,\n dataOrStream: string,\n { encoding = 'utf8' }: { encoding?: BufferEncoding } = {}\n): Promise<boolean> => {\n // Disabled because it's too slow. Build time increases from 3s to 7s.\n await writeFile(path, dataOrStream, { encoding });\n\n // 1) write new content to temporary file (stream-safe)\n // const tmp = `${path}.tmp`;\n\n // if (isReadableStream(dataOrStream)) {\n // await pipeline(dataOrStream, createWriteStream(tmp));\n // } else {\n // // dataOrStream = string | Buffer\n // const buf = Buffer.isBuffer(dataOrStream)\n // ? dataOrStream\n // : Buffer.from(dataOrStream, encoding);\n // await writeFile(tmp, buf);\n // }\n\n // 2) if old file exists, compare hashes (streaming)\n // let same = false;\n // try {\n // const [oldHash, newHash] = await Promise.all([\n // hashFile(path),\n // hashFile(tmp),\n // ]);\n // same = oldHash === newHash;\n // } catch {\n // // old file missing -> will replace\n // }\n\n // if (same) {\n // await rm(tmp);\n // return false; // no change\n // }\n\n // 3) atomic replacement\n // On Unix, rename is atomic. On Windows, if file exists, we can delete it first.\n // try {\n // await rename(tmp, path);\n // } catch {\n // try {\n // await rm(path);\n // } catch {}\n // await rename(tmp, path);\n // }\n\n return true; // changed\n};\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAG1B,MAAM,WAAW,OAAO,SAAiB;AACvC,QAAM,IAAI,WAAW,QAAQ;AAC7B,QAAM,KAAK,iBAAiB,IAAI;AAChC,KAAG,GAAG,QAAQ,CAAC,UAAU,EAAE,OAAO,KAAK,CAAC;AACxC,QAAM,IAAI,QAAc,CAAC,KAAK,QAAQ;AACpC,OAAG,GAAG,OAAO,MAAM,IAAI,CAAC;AACxB,OAAG,GAAG,SAAS,GAAG;AAAA,EACpB,CAAC;AACD,SAAO,EAAE,OAAO,KAAK;AACvB;AAEA,MAAM,mBAAmB,CAAC,UACxB,CAAC,CAAC,SACF,OAAO,UAAU,YACjB,OAAQ,MAAc,SAAS;AAE1B,MAAM,qBAAqB,OAChC,MACA,cACA,EAAE,WAAW,OAAO,IAAmC,CAAC,MACnC;AAErB,QAAM,UAAU,MAAM,cAAc,EAAE,SAAS,CAAC;AA2ChD,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { writeFileIfChanged } from "./writeFileIfChanged.mjs";
|
|
2
|
+
const writeJsonIfChanged = async (path, data, { pretty = process.env.NODE_ENV === "development" } = {}) => {
|
|
3
|
+
const space = pretty ? 2 : void 0;
|
|
4
|
+
const json = JSON.stringify(data, null, space);
|
|
5
|
+
return await writeFileIfChanged(path, json);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
writeJsonIfChanged
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=writeJsonIfChanged.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/writeJsonIfChanged.ts"],"sourcesContent":["import { writeFileIfChanged } from './writeFileIfChanged';\n\nexport const writeJsonIfChanged = async <T>(\n path: string,\n data: T,\n { pretty = process.env.NODE_ENV === 'development' } = {}\n): Promise<boolean> => {\n const space = pretty ? 2 : undefined;\n const json = JSON.stringify(data, null, space);\n\n return await writeFileIfChanged(path, json);\n};\n"],"mappings":"AAAA,SAAS,0BAA0B;AAE5B,MAAM,qBAAqB,OAChC,MACA,MACA,EAAE,SAAS,QAAQ,IAAI,aAAa,cAAc,IAAI,CAAC,MAClC;AACrB,QAAM,QAAQ,SAAS,IAAI;AAC3B,QAAM,OAAO,KAAK,UAAU,MAAM,MAAM,KAAK;AAE7C,SAAO,MAAM,mBAAmB,MAAM,IAAI;AAC5C;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"fetchDistantDictionaries.d.ts","sourceRoot":"","sources":["../../src/fetchDistantDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,KAAK,+BAA+B,GAAG;IACrC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,+BAA+B,EACxC,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,IAAI,KACtD,OAAO,CAAC,aAAa,EAAE,CAgEzB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { buildAndWatchIntlayer, handleAdditionalContentDeclarationFile, handleContentDeclarationFileChange, watch, } from './chokidar/watcher';
|
|
2
2
|
export { cleanOutputDir } from './cleanOutputDir';
|
|
3
3
|
export { fetchDistantDictionaries } from './fetchDistantDictionaries';
|
|
4
|
-
export { fetchDistantDictionaryKeysAndUpdateTimestamp } from './fetchDistantDictionaryKeysAndUpdateTimestamp';
|
|
5
4
|
export { getBuiltDictionariesPath } from './getBuiltDictionariesPath';
|
|
6
5
|
export { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';
|
|
7
6
|
export { listDictionaries } from './listDictionariesPath';
|
|
@@ -12,9 +11,9 @@ export { prepareContentDeclaration } from './prepareContentDeclaration';
|
|
|
12
11
|
export { prepareIntlayer } from './prepareIntlayer';
|
|
13
12
|
export { processPerLocaleDictionary } from './processPerLocaleDictionary';
|
|
14
13
|
export { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';
|
|
15
|
-
export { buildDictionary } from './transpiler/declaration_file_to_dictionary/index';
|
|
16
14
|
export { createDictionaryEntryPoint, generateDictionaryListContent, } from './transpiler/dictionary_to_main';
|
|
17
15
|
export { createModuleAugmentation } from './transpiler/dictionary_to_type/createModuleAugmentation';
|
|
16
|
+
export { buildDictionary } from './transpiler/intlayer_dictionary/buildIntlayerDictionary';
|
|
18
17
|
export { formatLocale, formatPath } from './utils/formatter';
|
|
19
18
|
export { getFileHash } from './utils/getFileHash';
|
|
20
19
|
export { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sCAAsC,EACtC,kCAAkC,EAClC,KAAK,GACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sCAAsC,EACtC,kCAAkC,EAClC,KAAK,GACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC"}
|
|
@@ -9,5 +9,9 @@ export type DictionariesStatus = {
|
|
|
9
9
|
export declare const loadDictionaries: (contentDeclarationsPaths: string[] | string, configuration?: IntlayerConfig, projectRequire?: NodeJS.Require) => Promise<{
|
|
10
10
|
localDictionaries: Dictionary[];
|
|
11
11
|
remoteDictionaries: Dictionary[];
|
|
12
|
+
time: {
|
|
13
|
+
localDictionaries: number;
|
|
14
|
+
remoteDictionaries: number;
|
|
15
|
+
};
|
|
12
16
|
}>;
|
|
13
17
|
//# sourceMappingURL=loadDictionaries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,MAAM,EACF,SAAS,GACT,UAAU,GACV,SAAS,GACT,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAgIF,eAAO,MAAM,gBAAgB,GAC3B,0BAA0B,MAAM,EAAE,GAAG,MAAM,EAC3C,gBAAe,cAAmC,EAClD,+BAA+B,KAC9B,OAAO,CAAC;IACT,iBAAiB,EAAE,UAAU,EAAE,CAAC;IAChC,kBAAkB,EAAE,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"loadDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzB,MAAM,EACF,SAAS,GACT,UAAU,GACV,SAAS,GACT,OAAO,GACP,UAAU,GACV,OAAO,GACP,UAAU,GACV,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAgIF,eAAO,MAAM,gBAAgB,GAC3B,0BAA0B,MAAM,EAAE,GAAG,MAAM,EAC3C,gBAAe,cAAmC,EAClD,+BAA+B,KAC9B,OAAO,CAAC;IACT,iBAAiB,EAAE,UAAU,EAAE,CAAC;IAChC,kBAAkB,EAAE,UAAU,EAAE,CAAC;IACjC,IAAI,EAAE;QACJ,iBAAiB,EAAE,MAAM,CAAC;QAC1B,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH,CAqEA,CAAC"}
|
|
@@ -2,5 +2,9 @@ import type { DictionaryAPI } from '@intlayer/backend';
|
|
|
2
2
|
import type { Dictionary } from '@intlayer/core';
|
|
3
3
|
import { DictionariesStatus } from '../loadDictionaries/loadDictionaries';
|
|
4
4
|
export declare const formatDistantDictionaries: (dictionaries: DictionaryAPI[]) => Dictionary[];
|
|
5
|
-
export declare const loadRemoteDictionaries: (configuration?: import("@intlayer/config").IntlayerConfig, onStatusUpdate?: (status: DictionariesStatus[]) => void
|
|
5
|
+
export declare const loadRemoteDictionaries: (configuration?: import("@intlayer/config").IntlayerConfig, onStatusUpdate?: (status: DictionariesStatus[]) => void, options?: {
|
|
6
|
+
onStartRemoteCheck?: () => void;
|
|
7
|
+
onStopRemoteCheck?: () => void;
|
|
8
|
+
onError?: (error: Error) => void;
|
|
9
|
+
}) => Promise<DictionaryAPI[]>;
|
|
6
10
|
//# sourceMappingURL=loadRemoteDictionaries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadRemoteDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadRemoteDictionaries.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,eAAO,MAAM,yBAAyB,GACpC,cAAc,aAAa,EAAE,KAC5B,UAAU,EAKR,CAAC;AAEN,eAAO,MAAM,sBAAsB,GACjC,yDAAkC,EAClC,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,IAAI,EACvD,UAAU;IACR,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC,KACA,OAAO,CAAC,aAAa,EAAE,CAsHzB,CAAC"}
|
|
@@ -8,11 +8,18 @@ export declare class DictionariesLogger {
|
|
|
8
8
|
private isFinished;
|
|
9
9
|
private readonly prefix;
|
|
10
10
|
private lastRenderedState;
|
|
11
|
+
private remoteCheckInProgress;
|
|
12
|
+
private expectRemote;
|
|
13
|
+
private remoteError;
|
|
11
14
|
constructor();
|
|
15
|
+
setExpectRemote(expect: boolean): void;
|
|
16
|
+
startRemoteCheck(): void;
|
|
17
|
+
stopRemoteCheck(): void;
|
|
12
18
|
update(newStatuses: DictionariesStatus[]): void;
|
|
13
19
|
finish(): void;
|
|
14
20
|
private startSpinner;
|
|
15
21
|
private stopSpinner;
|
|
22
|
+
setRemoteError: (_error?: Error) => void;
|
|
16
23
|
private render;
|
|
17
24
|
private computeProgress;
|
|
18
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/loadDictionaries/log.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAAc;IACvC,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAS;;IAO5B,eAAe,CAAC,MAAM,EAAE,OAAO;IAI/B,gBAAgB;IAOhB,eAAe;IAIf,MAAM,CAAC,WAAW,EAAE,kBAAkB,EAAE;IAyBxC,MAAM;IAON,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,WAAW;IAMZ,cAAc,GAAI,SAAS,KAAK,UAGrC;IAEF,OAAO,CAAC,MAAM;IAuEd,OAAO,CAAC,eAAe;CAyCxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"prepareIntlayer.d.ts","sourceRoot":"","sources":["../../src/prepareIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAIpB,MAAM,kBAAkB,CAAC;AAa1B,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,EAClD,+BAA+B,EAC/B,eAAa,kBAkGd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDictionaryEntryPoint.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createDictionaryEntryPoint.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"names":[],"mappings":"AAoCA;;GAEG;AACH,eAAO,MAAM,0BAA0B,GACrC,yDAAkC,EAClC,mBAAmB,MAAM,EAAE,EAC3B,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,kBA6C5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createModuleAugmentation.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_type/createModuleAugmentation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createModuleAugmentation.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_type/createModuleAugmentation.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,MACH,CAAC;AA8FxC;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,yDAAkC,kBAoBnC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { LocalizedDictionaryOutput } from './writeDynamicDictionary';
|
|
|
3
3
|
/**
|
|
4
4
|
* This function transpile the bundled code to to make dictionaries as JSON files
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const buildDictionary: (localDictionariesEntries: Dictionary[], configuration?: import("@intlayer/config").IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<{
|
|
7
7
|
unmergedDictionaries: import("./writeUnmergedDictionary").UnmergedDictionaryOutput;
|
|
8
8
|
mergedDictionaries: import("./writeMergedDictionary").MergedDictionaryOutput;
|
|
9
9
|
dynamicDictionaries: LocalizedDictionaryOutput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildIntlayerDictionary.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/intlayer_dictionary/buildIntlayerDictionary.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,yBAAyB,EAE1B,MAAM,0BAA0B,CAAC;AAKlC;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,0BAA0B,UAAU,EAAE,EACtC,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB;;;;;EAwC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/intlayer_dictionary/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processContentDeclaration.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/intlayer_dictionary/processContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,yBAAyB,GACpC,oBAAoB,UAAU,KAC7B,OAAO,CAAC,UAAU,GAAG,SAAS,CAehC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeDynamicDictionary.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/intlayer_dictionary/writeDynamicDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,OAAO,EAER,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,MAAM,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAClC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAC5C,MAAM,EACN,yBAAyB,CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACvC,gCAAgC,yBAAyB,EACzD,SAAQ,KAAK,GAAG,KAAa,EAC7B,yDAAkC,KACjC,MAgCF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GACjC,oBAAoB,sBAAsB,EAC1C,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,KAC1C,OAAO,CAAC,yBAAyB,CAwEnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeFetchDictionary.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/intlayer_dictionary/writeFetchDictionary.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACvC,gCAAgC,yBAAyB,EACzD,SAAQ,KAAK,GAAG,KAAa,EAC7B,yDAAkC,KACjC,MA4BF,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,GAC/B,qBAAqB,yBAAyB,EAC9C,yDAAkC,EAClC,UAAS,CAAC,KAAK,GAAG,KAAK,CAAC,EAAmB,KAC1C,OAAO,CAAC,yBAAyB,CAoCnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeMergedDictionary.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/intlayer_dictionary/writeMergedDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,uBAAuB,GAClC,qBAAqB,wBAAwB,EAC7C,yDAAkC,KACjC,OAAO,CAAC,sBAAsB,CAgDhC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeRemoteDictionary.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/intlayer_dictionary/writeRemoteDictionary.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQ5C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,GAChC,oBAAoB,UAAU,EAAE,EAChC,yDAAkC,KACjC,OAAO,CAAC,UAAU,EAAE,CA0BtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeUnmergedDictionary.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/intlayer_dictionary/writeUnmergedDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAuBjD,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,UAAU,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,GACpC,cAAc,UAAU,EAAE,EAC1B,yDAAkC,KACjC,OAAO,CAAC,wBAAwB,CAsDlC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/writeConfiguration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/writeConfiguration/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,eAAO,MAAM,kBAAkB,GAAU,eAAe,cAAc,kBAWrE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"writeContentDeclaration.d.ts","sourceRoot":"","sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAsB3D,eAAO,MAAM,uBAAuB,GAClC,YAAY,UAAU,EACtB,SAAQ,cAA8B,EACtC,sBAAsB,MAAM,KAC3B,OAAO,CAAC;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA0DpD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeFileIfChanged.d.ts","sourceRoot":"","sources":["../../src/writeFileIfChanged.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,kBAAkB,GAC7B,MAAM,MAAM,EACZ,cAAc,MAAM,EACpB,eAAuB;IAAE,QAAQ,CAAC,EAAE,cAAc,CAAA;CAAO,KACxD,OAAO,CAAC,OAAO,CA8CjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeJsonIfChanged.d.ts","sourceRoot":"","sources":["../../src/writeJsonIfChanged.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,GAAU,CAAC,EACxC,MAAM,MAAM,EACZ,MAAM,CAAC,EACP;;CAAwD,KACvD,OAAO,CAAC,OAAO,CAKjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/chokidar",
|
|
3
|
-
"version": "6.0.0
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.",
|
|
6
6
|
"keywords": [
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"fast-glob": "^3.3.3",
|
|
69
69
|
"p-limit": "^3.1.0",
|
|
70
70
|
"simple-git": "^3.27.0",
|
|
71
|
-
"@intlayer/api": "6.0.0
|
|
72
|
-
"@intlayer/
|
|
73
|
-
"@intlayer/
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"@intlayer/
|
|
76
|
-
"@intlayer/dictionaries-entry": "6.0.0
|
|
71
|
+
"@intlayer/api": "6.0.0",
|
|
72
|
+
"@intlayer/dictionaries-entry": "6.0.0",
|
|
73
|
+
"@intlayer/core": "6.0.0",
|
|
74
|
+
"@intlayer/config": "6.0.0",
|
|
75
|
+
"@intlayer/remote-dictionaries-entry": "6.0.0",
|
|
76
|
+
"@intlayer/unmerged-dictionaries-entry": "6.0.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@changesets/cli": "2.29.5",
|
|
@@ -91,21 +91,21 @@
|
|
|
91
91
|
"tsup": "^8.5.0",
|
|
92
92
|
"typescript": "^5.9.2",
|
|
93
93
|
"vitest": "^3.2.4",
|
|
94
|
-
"@utils/eslint-config": "1.0.4",
|
|
95
94
|
"@utils/ts-config-types": "1.0.4",
|
|
95
|
+
"@utils/eslint-config": "1.0.4",
|
|
96
96
|
"@utils/tsup-config": "1.0.4",
|
|
97
97
|
"@utils/ts-config": "1.0.4"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"fast-glob": "^3.3.3",
|
|
101
101
|
"react": ">=16.0.0",
|
|
102
|
-
"@intlayer/api": "6.0.0
|
|
103
|
-
"@intlayer/
|
|
104
|
-
"@intlayer/
|
|
105
|
-
"@intlayer/dictionaries-entry": "6.0.0
|
|
106
|
-
"@intlayer/
|
|
107
|
-
"@intlayer/
|
|
108
|
-
"intlayer": "6.0.0
|
|
102
|
+
"@intlayer/api": "6.0.0",
|
|
103
|
+
"@intlayer/config": "6.0.0",
|
|
104
|
+
"@intlayer/dictionaries-entry": "6.0.0",
|
|
105
|
+
"@intlayer/remote-dictionaries-entry": "6.0.0",
|
|
106
|
+
"@intlayer/unmerged-dictionaries-entry": "6.0.0",
|
|
107
|
+
"@intlayer/core": "6.0.0",
|
|
108
|
+
"intlayer": "6.0.0"
|
|
109
109
|
},
|
|
110
110
|
"engines": {
|
|
111
111
|
"node": ">=14.18"
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var fetchDistantDictionaryKeysAndUpdateTimestamp_exports = {};
|
|
20
|
-
__export(fetchDistantDictionaryKeysAndUpdateTimestamp_exports, {
|
|
21
|
-
fetchDistantDictionaryKeysAndUpdateTimestamp: () => fetchDistantDictionaryKeysAndUpdateTimestamp
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(fetchDistantDictionaryKeysAndUpdateTimestamp_exports);
|
|
24
|
-
var import_api = require("@intlayer/api");
|
|
25
|
-
var import_config = require("@intlayer/config");
|
|
26
|
-
const fetchDistantDictionaryKeysAndUpdateTimestamp = async (configuration = (0, import_config.getConfiguration)()) => {
|
|
27
|
-
const { clientId, clientSecret } = configuration.editor;
|
|
28
|
-
if (!clientId || !clientSecret) {
|
|
29
|
-
throw new Error(
|
|
30
|
-
"Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project."
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
const intlayerAPI = (0, import_api.getIntlayerAPIProxy)(void 0, configuration);
|
|
34
|
-
const getDictionariesKeysResult = await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();
|
|
35
|
-
if (!getDictionariesKeysResult.data) {
|
|
36
|
-
throw new Error("No distant dictionaries found");
|
|
37
|
-
}
|
|
38
|
-
const distantDictionariesUpdateTimeStamp = getDictionariesKeysResult.data;
|
|
39
|
-
return distantDictionariesUpdateTimeStamp;
|
|
40
|
-
};
|
|
41
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
-
0 && (module.exports = {
|
|
43
|
-
fetchDistantDictionaryKeysAndUpdateTimestamp
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=fetchDistantDictionaryKeysAndUpdateTimestamp.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/fetchDistantDictionaryKeysAndUpdateTimestamp.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config';\n\nexport const fetchDistantDictionaryKeysAndUpdateTimestamp = async (\n configuration: IntlayerConfig = getConfiguration()\n): Promise<Record<string, number>> => {\n const { clientId, clientSecret } = configuration.editor;\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();\n\n if (!getDictionariesKeysResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n const distantDictionariesUpdateTimeStamp: Record<string, number> =\n getDictionariesKeysResult.data;\n\n // Apply any filtering if needed\n return distantDictionariesUpdateTimeStamp;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoC;AACpC,oBAAsD;AAE/C,MAAM,+CAA+C,OAC1D,oBAAgC,gCAAiB,MACb;AACpC,QAAM,EAAE,UAAU,aAAa,IAAI,cAAc;AAEjD,MAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kBAAc,gCAAoB,QAAW,aAAa;AAGhE,QAAM,4BACJ,MAAM,YAAY,WAAW,+BAA+B;AAE9D,MAAI,CAAC,0BAA0B,MAAM;AACnC,UAAM,IAAI,MAAM,+BAA+B;AAAA,EACjD;AAEA,QAAM,qCACJ,0BAA0B;AAG5B,SAAO;AACT;","names":[]}
|