@intlayer/chokidar 6.0.2 → 6.1.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/README.md +249 -66
- package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/buildIntlayerDictionary.cjs +18 -2
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -0
- package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/index.cjs +4 -4
- package/dist/cjs/buildIntlayerDictionary/index.cjs.map +1 -0
- package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/processContentDeclaration.cjs +1 -1
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -0
- package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeDynamicDictionary.cjs +3 -3
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -0
- package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeFetchDictionary.cjs +2 -2
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -0
- package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeMergedDictionary.cjs +4 -4
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -0
- package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeRemoteDictionary.cjs +4 -4
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -0
- package/dist/cjs/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeUnmergedDictionary.cjs +4 -4
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -0
- package/dist/cjs/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/createDictionaryEntryPoint.cjs +7 -7
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -0
- package/dist/cjs/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/generateDictionaryListContent.cjs +1 -1
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -0
- package/dist/cjs/createDictionaryEntryPoint/index.cjs +35 -0
- package/dist/cjs/createDictionaryEntryPoint/index.cjs.map +1 -0
- package/dist/cjs/{transpiler/dictionary_to_type → createType}/createModuleAugmentation.cjs +3 -3
- package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -0
- package/dist/cjs/{transpiler/dictionary_to_type → createType}/createType.cjs +1 -1
- package/dist/cjs/createType/createType.cjs.map +1 -0
- package/dist/cjs/{transpiler/dictionary_to_type → createType}/index.cjs +4 -4
- package/dist/cjs/createType/index.cjs.map +1 -0
- package/dist/cjs/filterInvalidDictionaries.cjs +32 -40
- package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +54 -0
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -0
- package/dist/cjs/handleContentDeclarationFileChange.cjs +59 -0
- package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -0
- package/dist/cjs/handleUnlikedContentDeclarationFile.cjs +57 -0
- package/dist/cjs/handleUnlikedContentDeclarationFile.cjs.map +1 -0
- package/dist/cjs/index.cjs +35 -12
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/listDictionariesPath.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +6 -3
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +8 -4
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +10 -8
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +2 -2
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
- package/dist/cjs/utils/extractErrorMessage.cjs +22 -10
- package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
- package/dist/cjs/utils/parallelize.cjs +139 -12
- package/dist/cjs/utils/parallelize.cjs.map +1 -1
- package/dist/cjs/utils/runParallel.cjs +77 -0
- package/dist/cjs/utils/runParallel.cjs.map +1 -0
- package/dist/cjs/watcher.cjs +89 -0
- package/dist/cjs/watcher.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +770 -0
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +46 -55
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +12 -288
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
- package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/buildIntlayerDictionary.mjs +18 -2
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -0
- package/dist/esm/buildIntlayerDictionary/index.mjs.map +1 -0
- package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/processContentDeclaration.mjs +1 -1
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -0
- package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeDynamicDictionary.mjs +3 -3
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -0
- package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeFetchDictionary.mjs +2 -2
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -0
- package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeMergedDictionary.mjs +4 -4
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -0
- package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeRemoteDictionary.mjs +4 -4
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -0
- package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeUnmergedDictionary.mjs +4 -4
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -0
- package/dist/esm/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/createDictionaryEntryPoint.mjs +7 -7
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -0
- package/dist/esm/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/generateDictionaryListContent.mjs +1 -1
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -0
- package/dist/esm/createDictionaryEntryPoint/index.mjs +8 -0
- package/dist/esm/createDictionaryEntryPoint/index.mjs.map +1 -0
- package/dist/esm/{transpiler/dictionary_to_type → createType}/createModuleAugmentation.mjs +3 -3
- package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -0
- package/dist/esm/{transpiler/dictionary_to_type → createType}/createType.mjs +1 -1
- package/dist/esm/createType/createType.mjs.map +1 -0
- package/dist/esm/createType/index.mjs.map +1 -0
- package/dist/esm/filterInvalidDictionaries.mjs +29 -28
- package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs +30 -0
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -0
- package/dist/esm/handleContentDeclarationFileChange.mjs +35 -0
- package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -0
- package/dist/esm/handleUnlikedContentDeclarationFile.mjs +33 -0
- package/dist/esm/handleUnlikedContentDeclarationFile.mjs.map +1 -0
- package/dist/esm/index.mjs +29 -14
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/listDictionariesPath.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +10 -4
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +12 -5
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +8 -9
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +2 -2
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
- package/dist/esm/utils/extractErrorMessage.mjs +22 -10
- package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
- package/dist/esm/utils/parallelize.mjs +137 -1
- package/dist/esm/utils/parallelize.mjs.map +1 -1
- package/dist/esm/utils/runParallel.mjs +43 -0
- package/dist/esm/utils/runParallel.mjs.map +1 -0
- package/dist/esm/watcher.mjs +67 -0
- package/dist/esm/watcher.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs +751 -0
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +47 -56
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +15 -279
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
- package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/buildIntlayerDictionary.d.ts +1 -1
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/index.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -0
- package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +1 -0
- package/dist/types/createDictionaryEntryPoint/index.d.ts +8 -0
- package/dist/types/createDictionaryEntryPoint/index.d.ts.map +1 -0
- package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -0
- package/dist/types/createType/createType.d.ts.map +1 -0
- package/dist/types/createType/index.d.ts.map +1 -0
- package/dist/types/filterInvalidDictionaries.d.ts +3 -1
- package/dist/types/filterInvalidDictionaries.d.ts.map +1 -1
- package/dist/types/handleAdditionalContentDeclarationFile.d.ts +3 -0
- package/dist/types/handleAdditionalContentDeclarationFile.d.ts.map +1 -0
- package/dist/types/handleContentDeclarationFileChange.d.ts +3 -0
- package/dist/types/handleContentDeclarationFileChange.d.ts.map +1 -0
- package/dist/types/handleUnlikedContentDeclarationFile.d.ts +3 -0
- package/dist/types/handleUnlikedContentDeclarationFile.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/listDictionariesPath.d.ts +5 -0
- package/dist/types/listDictionariesPath.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +1 -1
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +2 -1
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -1
- package/dist/types/prepareIntlayer.d.ts +1 -1
- package/dist/types/prepareIntlayer.d.ts.map +1 -1
- package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +1 -1
- package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts.map +1 -1
- package/dist/types/utils/extractErrorMessage.d.ts.map +1 -1
- package/dist/types/utils/parallelize.d.ts +12 -0
- package/dist/types/utils/parallelize.d.ts.map +1 -1
- package/dist/types/utils/runParallel.d.ts +11 -0
- package/dist/types/utils/runParallel.d.ts.map +1 -0
- package/dist/types/watcher.d.ts +12 -0
- package/dist/types/watcher.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts +9 -0
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts +3 -2
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
- package/package.json +22 -27
- package/dist/cjs/chokidar/index.cjs +0 -23
- package/dist/cjs/chokidar/index.cjs.map +0 -1
- package/dist/cjs/chokidar/watcher.cjs +0 -157
- package/dist/cjs/chokidar/watcher.cjs.map +0 -1
- package/dist/cjs/getBuiltDictionariesPath.cjs.map +0 -1
- package/dist/cjs/getBuiltDynamicDictionariesPath.cjs.map +0 -1
- package/dist/cjs/getBuiltFetchDictionariesPath.cjs.map +0 -1
- package/dist/cjs/getBuiltRemoteDictionariesPath.cjs.map +0 -1
- package/dist/cjs/getBuiltUnmergedDictionariesPath.cjs.map +0 -1
- package/dist/cjs/reduceDictionaryContent/buildMask.cjs +0 -49
- package/dist/cjs/reduceDictionaryContent/buildMask.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_main/generateDictionaryListContent.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_main/index.cjs +0 -25
- package/dist/cjs/transpiler/dictionary_to_main/index.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_type/createType.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_type/index.cjs.map +0 -1
- package/dist/cjs/transpiler/intlayer_dictionary/buildIntlayerDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/intlayer_dictionary/index.cjs.map +0 -1
- package/dist/cjs/transpiler/intlayer_dictionary/processContentDeclaration.cjs.map +0 -1
- package/dist/cjs/transpiler/intlayer_dictionary/writeDynamicDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/intlayer_dictionary/writeFetchDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/intlayer_dictionary/writeMergedDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/intlayer_dictionary/writeRemoteDictionary.cjs.map +0 -1
- package/dist/cjs/transpiler/intlayer_dictionary/writeUnmergedDictionary.cjs.map +0 -1
- package/dist/esm/chokidar/index.mjs +0 -2
- package/dist/esm/chokidar/index.mjs.map +0 -1
- package/dist/esm/chokidar/watcher.mjs +0 -135
- package/dist/esm/chokidar/watcher.mjs.map +0 -1
- package/dist/esm/getBuiltDictionariesPath.mjs.map +0 -1
- package/dist/esm/getBuiltDynamicDictionariesPath.mjs.map +0 -1
- package/dist/esm/getBuiltFetchDictionariesPath.mjs.map +0 -1
- package/dist/esm/getBuiltRemoteDictionariesPath.mjs.map +0 -1
- package/dist/esm/getBuiltUnmergedDictionariesPath.mjs.map +0 -1
- package/dist/esm/reduceDictionaryContent/buildMask.mjs +0 -24
- package/dist/esm/reduceDictionaryContent/buildMask.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_main/generateDictionaryListContent.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_main/index.mjs +0 -3
- package/dist/esm/transpiler/dictionary_to_main/index.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_type/createType.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_type/index.mjs.map +0 -1
- package/dist/esm/transpiler/intlayer_dictionary/buildIntlayerDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/intlayer_dictionary/index.mjs.map +0 -1
- package/dist/esm/transpiler/intlayer_dictionary/processContentDeclaration.mjs.map +0 -1
- package/dist/esm/transpiler/intlayer_dictionary/writeDynamicDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/intlayer_dictionary/writeFetchDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/intlayer_dictionary/writeMergedDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/intlayer_dictionary/writeRemoteDictionary.mjs.map +0 -1
- package/dist/esm/transpiler/intlayer_dictionary/writeUnmergedDictionary.mjs.map +0 -1
- package/dist/types/chokidar/index.d.ts +0 -2
- package/dist/types/chokidar/index.d.ts.map +0 -1
- package/dist/types/chokidar/watcher.d.ts +0 -14
- package/dist/types/chokidar/watcher.d.ts.map +0 -1
- package/dist/types/getBuiltDictionariesPath.d.ts.map +0 -1
- package/dist/types/getBuiltDynamicDictionariesPath.d.ts.map +0 -1
- package/dist/types/getBuiltFetchDictionariesPath.d.ts.map +0 -1
- package/dist/types/getBuiltRemoteDictionariesPath.d.ts.map +0 -1
- package/dist/types/getBuiltUnmergedDictionariesPath.d.ts.map +0 -1
- package/dist/types/reduceDictionaryContent/buildMask.d.ts +0 -5
- package/dist/types/reduceDictionaryContent/buildMask.d.ts.map +0 -1
- package/dist/types/transpiler/dictionary_to_main/createDictionaryEntryPoint.d.ts.map +0 -1
- package/dist/types/transpiler/dictionary_to_main/generateDictionaryListContent.d.ts.map +0 -1
- package/dist/types/transpiler/dictionary_to_main/index.d.ts +0 -3
- package/dist/types/transpiler/dictionary_to_main/index.d.ts.map +0 -1
- package/dist/types/transpiler/dictionary_to_type/createModuleAugmentation.d.ts.map +0 -1
- package/dist/types/transpiler/dictionary_to_type/createType.d.ts.map +0 -1
- package/dist/types/transpiler/dictionary_to_type/index.d.ts.map +0 -1
- package/dist/types/transpiler/intlayer_dictionary/buildIntlayerDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/intlayer_dictionary/index.d.ts.map +0 -1
- package/dist/types/transpiler/intlayer_dictionary/processContentDeclaration.d.ts.map +0 -1
- package/dist/types/transpiler/intlayer_dictionary/writeDynamicDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/intlayer_dictionary/writeFetchDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/intlayer_dictionary/writeMergedDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/intlayer_dictionary/writeRemoteDictionary.d.ts.map +0 -1
- package/dist/types/transpiler/intlayer_dictionary/writeUnmergedDictionary.d.ts.map +0 -1
- /package/dist/cjs/{getBuiltDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltDictionariesPath.cjs} +0 -0
- /package/dist/cjs/{getBuiltDynamicDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs} +0 -0
- /package/dist/cjs/{getBuiltFetchDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs} +0 -0
- /package/dist/cjs/{getBuiltRemoteDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs} +0 -0
- /package/dist/cjs/{getBuiltUnmergedDictionariesPath.cjs → createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs} +0 -0
- /package/dist/esm/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/index.mjs +0 -0
- /package/dist/esm/{getBuiltDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltDictionariesPath.mjs} +0 -0
- /package/dist/esm/{getBuiltDynamicDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs} +0 -0
- /package/dist/esm/{getBuiltFetchDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs} +0 -0
- /package/dist/esm/{getBuiltRemoteDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs} +0 -0
- /package/dist/esm/{getBuiltUnmergedDictionariesPath.mjs → createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs} +0 -0
- /package/dist/esm/{transpiler/dictionary_to_type → createType}/index.mjs +0 -0
- /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/index.d.ts +0 -0
- /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/processContentDeclaration.d.ts +0 -0
- /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeDynamicDictionary.d.ts +0 -0
- /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeFetchDictionary.d.ts +0 -0
- /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeMergedDictionary.d.ts +0 -0
- /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeRemoteDictionary.d.ts +0 -0
- /package/dist/types/{transpiler/intlayer_dictionary → buildIntlayerDictionary}/writeUnmergedDictionary.d.ts +0 -0
- /package/dist/types/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/createDictionaryEntryPoint.d.ts +0 -0
- /package/dist/types/{transpiler/dictionary_to_main → createDictionaryEntryPoint}/generateDictionaryListContent.d.ts +0 -0
- /package/dist/types/{getBuiltDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts} +0 -0
- /package/dist/types/{getBuiltDynamicDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts} +0 -0
- /package/dist/types/{getBuiltFetchDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts} +0 -0
- /package/dist/types/{getBuiltRemoteDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts} +0 -0
- /package/dist/types/{getBuiltUnmergedDictionariesPath.d.ts → createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts} +0 -0
- /package/dist/types/{transpiler/dictionary_to_type → createType}/createModuleAugmentation.d.ts +0 -0
- /package/dist/types/{transpiler/dictionary_to_type → createType}/createType.d.ts +0 -0
- /package/dist/types/{transpiler/dictionary_to_type → createType}/index.d.ts +0 -0
|
@@ -1,157 +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 watcher_exports = {};
|
|
20
|
-
__export(watcher_exports, {
|
|
21
|
-
buildAndWatchIntlayer: () => buildAndWatchIntlayer,
|
|
22
|
-
handleAdditionalContentDeclarationFile: () => handleAdditionalContentDeclarationFile,
|
|
23
|
-
handleContentDeclarationFileChange: () => handleContentDeclarationFileChange,
|
|
24
|
-
handleUnlikedContentDeclarationFile: () => handleUnlikedContentDeclarationFile,
|
|
25
|
-
watch: () => watch
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(watcher_exports);
|
|
28
|
-
var import_config = require("@intlayer/config");
|
|
29
|
-
var import_path = require("path");
|
|
30
|
-
var import_chokidar = require("chokidar");
|
|
31
|
-
var import_getBuiltDictionariesPath = require('../getBuiltDictionariesPath.cjs');
|
|
32
|
-
var import_listDictionariesPath = require('../listDictionariesPath.cjs');
|
|
33
|
-
var import_loadLocalDictionaries = require('../loadDictionaries/loadLocalDictionaries.cjs');
|
|
34
|
-
var import_prepareIntlayer = require('../prepareIntlayer.cjs');
|
|
35
|
-
var import_createDictionaryEntryPoint = require('../transpiler/dictionary_to_main/createDictionaryEntryPoint.cjs');
|
|
36
|
-
var import_dictionary_to_type = require('../transpiler/dictionary_to_type/index.cjs');
|
|
37
|
-
var import_buildIntlayerDictionary = require('../transpiler/intlayer_dictionary/buildIntlayerDictionary.cjs');
|
|
38
|
-
var import_formatter = require('../utils/formatter.cjs');
|
|
39
|
-
const recentlyAddedFiles = /* @__PURE__ */ new Set();
|
|
40
|
-
const handleAdditionalContentDeclarationFile = async (filePath, configuration) => {
|
|
41
|
-
const config = configuration ?? (0, import_config.getConfiguration)();
|
|
42
|
-
const appLogger = (0, import_config.getAppLogger)(config);
|
|
43
|
-
appLogger(`Additional file detected: ${(0, import_formatter.formatPath)(filePath)}`, {
|
|
44
|
-
isVerbose: true
|
|
45
|
-
});
|
|
46
|
-
const localeDictionaries = await (0, import_loadLocalDictionaries.loadLocalDictionaries)(filePath);
|
|
47
|
-
const dictionariesOutput = await (0, import_buildIntlayerDictionary.buildDictionary)(localeDictionaries, config);
|
|
48
|
-
const dictionariesPaths = Object.values(
|
|
49
|
-
dictionariesOutput?.mergedDictionaries ?? {}
|
|
50
|
-
).map((dictionary) => dictionary.dictionaryPath);
|
|
51
|
-
await (0, import_dictionary_to_type.createTypes)(dictionariesPaths);
|
|
52
|
-
await (0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
|
|
53
|
-
appLogger("Dictionaries built", {
|
|
54
|
-
isVerbose: true
|
|
55
|
-
});
|
|
56
|
-
(0, import_dictionary_to_type.createModuleAugmentation)();
|
|
57
|
-
appLogger("Module augmentation built", {
|
|
58
|
-
isVerbose: true
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
const handleUnlikedContentDeclarationFile = async (filePath, configuration) => {
|
|
62
|
-
const config = configuration ?? (0, import_config.getConfiguration)();
|
|
63
|
-
const appLogger = (0, import_config.getAppLogger)(config);
|
|
64
|
-
appLogger(`Unlinked detected: ${(0, import_formatter.formatPath)(filePath)}`, {
|
|
65
|
-
isVerbose: true
|
|
66
|
-
});
|
|
67
|
-
const files = (0, import_listDictionariesPath.listDictionaries)(configuration);
|
|
68
|
-
const localeDictionaries = await (0, import_loadLocalDictionaries.loadLocalDictionaries)(files);
|
|
69
|
-
const dictionariesOutput = await (0, import_buildIntlayerDictionary.buildDictionary)(localeDictionaries, config);
|
|
70
|
-
const dictionariesPaths = Object.values(
|
|
71
|
-
dictionariesOutput?.mergedDictionaries ?? {}
|
|
72
|
-
).map((dictionary) => dictionary.dictionaryPath);
|
|
73
|
-
await (0, import_dictionary_to_type.createTypes)(dictionariesPaths);
|
|
74
|
-
await (0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
|
|
75
|
-
appLogger("Dictionaries rebuilt", {
|
|
76
|
-
isVerbose: true
|
|
77
|
-
});
|
|
78
|
-
await (0, import_dictionary_to_type.createModuleAugmentation)();
|
|
79
|
-
appLogger("Module augmentation built", {
|
|
80
|
-
isVerbose: true
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
const handleContentDeclarationFileChange = async (filePath, configuration) => {
|
|
84
|
-
const config = configuration ?? (0, import_config.getConfiguration)();
|
|
85
|
-
const appLogger = (0, import_config.getAppLogger)(config);
|
|
86
|
-
appLogger(`Change detected: ${(0, import_formatter.formatPath)(filePath)}`, {
|
|
87
|
-
isVerbose: true
|
|
88
|
-
});
|
|
89
|
-
const localeDictionaries = await (0, import_loadLocalDictionaries.loadLocalDictionaries)(filePath);
|
|
90
|
-
const dictionariesOutput = await (0, import_buildIntlayerDictionary.buildDictionary)(localeDictionaries, config);
|
|
91
|
-
const updatedDictionariesPaths = Object.values(
|
|
92
|
-
dictionariesOutput?.mergedDictionaries ?? {}
|
|
93
|
-
).map((dictionary) => dictionary.dictionaryPath);
|
|
94
|
-
const allDictionariesPaths = (0, import_getBuiltDictionariesPath.getBuiltDictionariesPath)();
|
|
95
|
-
(0, import_dictionary_to_type.createTypes)(updatedDictionariesPaths);
|
|
96
|
-
appLogger("TypeScript types built", {
|
|
97
|
-
isVerbose: true
|
|
98
|
-
});
|
|
99
|
-
if (updatedDictionariesPaths.some(
|
|
100
|
-
(updatedDictionaryPath) => !allDictionariesPaths.includes(updatedDictionaryPath)
|
|
101
|
-
)) {
|
|
102
|
-
await (0, import_createDictionaryEntryPoint.createDictionaryEntryPoint)();
|
|
103
|
-
appLogger("Dictionary list built", {
|
|
104
|
-
isVerbose: true
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const watch = (options) => {
|
|
109
|
-
const configuration = options?.configuration ?? (0, import_config.getConfiguration)();
|
|
110
|
-
const appLogger = (0, import_config.getAppLogger)(configuration);
|
|
111
|
-
const { watch: isWatchMode, watchedFilesPatternWithPath } = configuration.content;
|
|
112
|
-
return (0, import_chokidar.watch)(watchedFilesPatternWithPath, {
|
|
113
|
-
persistent: isWatchMode,
|
|
114
|
-
// Make the watcher persistent
|
|
115
|
-
ignoreInitial: true,
|
|
116
|
-
// Process existing files
|
|
117
|
-
...options
|
|
118
|
-
}).on("add", async (filePath) => {
|
|
119
|
-
const fileName = (0, import_path.basename)(filePath);
|
|
120
|
-
recentlyAddedFiles.add(fileName);
|
|
121
|
-
await handleAdditionalContentDeclarationFile(filePath, configuration);
|
|
122
|
-
setTimeout(() => recentlyAddedFiles.delete(fileName), 1e3);
|
|
123
|
-
}).on(
|
|
124
|
-
"change",
|
|
125
|
-
async (filePath) => await handleContentDeclarationFileChange(filePath, configuration)
|
|
126
|
-
).on("unlink", async (filePath) => {
|
|
127
|
-
setTimeout(async () => {
|
|
128
|
-
const fileName = (0, import_path.basename)(filePath);
|
|
129
|
-
if (recentlyAddedFiles.has(fileName)) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
await handleUnlikedContentDeclarationFile(filePath, configuration);
|
|
133
|
-
}, 300);
|
|
134
|
-
}).on("error", async (error) => {
|
|
135
|
-
appLogger("Watcher error: " + error, {
|
|
136
|
-
level: "error"
|
|
137
|
-
});
|
|
138
|
-
appLogger("Restarting watcher");
|
|
139
|
-
await (0, import_prepareIntlayer.prepareIntlayer)(configuration);
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
const buildAndWatchIntlayer = async (options) => {
|
|
143
|
-
const configuration = options?.configuration ?? (0, import_config.getConfiguration)(options?.configOptions);
|
|
144
|
-
await (0, import_prepareIntlayer.prepareIntlayer)(configuration);
|
|
145
|
-
if (configuration.content.watch || options.persistent) {
|
|
146
|
-
watch({ ...options, configuration });
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
150
|
-
0 && (module.exports = {
|
|
151
|
-
buildAndWatchIntlayer,
|
|
152
|
-
handleAdditionalContentDeclarationFile,
|
|
153
|
-
handleContentDeclarationFileChange,
|
|
154
|
-
handleUnlikedContentDeclarationFile,
|
|
155
|
-
watch
|
|
156
|
-
});
|
|
157
|
-
//# sourceMappingURL=watcher.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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 } 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 { createDictionaryEntryPoint } from '../transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from '../transpiler/dictionary_to_type/index';\nimport { buildDictionary } from '../transpiler/intlayer_dictionary/buildIntlayerDictionary';\nimport { formatPath } from '../utils/formatter';\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\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await 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\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(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, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await createDictionaryEntryPoint();\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await 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\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n const allDictionariesPaths: string[] = 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 await 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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKO;AACP,kBAAyB;AAEzB,sBAA6D;AAC7D,sCAAyC;AACzC,kCAAiC;AACjC,mCAAsC;AACt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,IACA,OAAO,aACL,MAAM,mCAAmC,UAAU,aAAa;AAAA,EACpE,EACC,GAAG,UAAU,OAAO,aAAa;AAChC,eAAW,YAAY;AACrB,YAAM,eAAW,sBAAS,QAAQ;AAElC,UAAI,mBAAmB,IAAI,QAAQ,GAAG;AAEpC;AAAA,MACF;AAEA,YAAM,oCAAoC,UAAU,aAAa;AAAA,IACnE,GAAG,GAAG;AAAA,EACR,CAAC,EACA,GAAG,SAAS,OAAO,UAAU;AAC5B,cAAU,oBAAoB,OAAO;AAAA,MACnC,OAAO;AAAA,IACT,CAAC;AAED,cAAU,oBAAoB;AAE9B,cAAM,wCAAgB,aAAa;AAAA,EACrC,CAAC;AACL;AAEO,MAAM,wBAAwB,OAAO,YAA2B;AACrE,QAAM,gBACJ,SAAS,qBAAiB,gCAAiB,SAAS,aAAa;AAEnE,YAAM,wCAAgB,aAAa;AAEnC,MAAI,cAAc,QAAQ,SAAS,QAAQ,YAAY;AAErD,UAAM,EAAE,GAAG,SAAS,cAAc,CAAC;AAAA,EACrC;AACF;","names":["chokidarWatch"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getBuiltDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } 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 getBuiltDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { dictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(dictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,uBAAe;AACf,gBAAsC;AAK/B,MAAM,2BAA2B,CACtC,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,iBAAiB,QAAQ,IAAI,cAAc;AAGnD,MAAI,KAAC,sBAAW,OAAO,GAAG;AACxB,6BAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,iBAAAA,QAAG;AAAA,IACpC,OAAG,6BAAc,eAAe,CAAC;AAAA,EACnC;AAEA,SAAO;AACT;","names":["fg"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getBuiltDynamicDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } 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 `${normalizePath(dynamicDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,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,OAAG,6BAAc,sBAAsB,CAAC,SAAS,SAAS;AAAA,EAC5D;AAEA,SAAO;AACT;","names":["fg"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getBuiltFetchDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } 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 getBuiltFetchDictionariesPath = (\n configuration = getConfiguration(),\n format: 'cjs' | 'esm' = 'esm'\n) => {\n const { fetchDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(fetchDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,uBAAe;AACf,gBAAsC;AAK/B,MAAM,gCAAgC,CAC3C,oBAAgB,gCAAiB,GACjC,SAAwB,UACrB;AACH,QAAM,EAAE,sBAAsB,QAAQ,IAAI,cAAc;AAGxD,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,OAAG,6BAAc,oBAAoB,CAAC,SAAS,SAAS;AAAA,EAC1D;AAEA,SAAO;AACT;","names":["fg"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getBuiltRemoteDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } 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 getBuiltRemoteDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { remoteDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(remoteDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,uBAAe;AACf,gBAAsC;AAK/B,MAAM,iCAAiC,CAC5C,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,uBAAuB,QAAQ,IAAI,cAAc;AAGzD,MAAI,KAAC,sBAAW,OAAO,GAAG;AACxB,6BAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,iBAAAA,QAAG;AAAA,IACpC,OAAG,6BAAc,qBAAqB,CAAC;AAAA,EACzC;AAEA,SAAO;AACT;","names":["fg"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getBuiltUnmergedDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } 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 getBuiltUnmergedDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { unmergedDictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(unmergedDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,uBAAe;AACf,gBAAsC;AAK/B,MAAM,mCAAmC,CAC9C,oBAAgB,gCAAiB,MAC9B;AACH,QAAM,EAAE,yBAAyB,QAAQ,IAAI,cAAc;AAG3D,MAAI,KAAC,sBAAW,OAAO,GAAG;AACxB,6BAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,iBAAAA,QAAG;AAAA,IACpC,OAAG,6BAAc,uBAAuB,CAAC;AAAA,EAC3C;AAEA,SAAO;AACT;","names":["fg"]}
|
|
@@ -1,49 +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 buildMask_exports = {};
|
|
20
|
-
__export(buildMask_exports, {
|
|
21
|
-
buildMask: () => buildMask,
|
|
22
|
-
buildMaskPlugin: () => buildMaskPlugin
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(buildMask_exports);
|
|
25
|
-
var import_core = require("@intlayer/core");
|
|
26
|
-
const passTypedNodePlugin = {
|
|
27
|
-
id: "pass-typed-node-plugin",
|
|
28
|
-
canHandle: (node) => typeof node === "object" && typeof node?.nodeType === "string",
|
|
29
|
-
transform: (node, props, deepTransformNode2) => deepTransformNode2(node[node.nodeType], props)
|
|
30
|
-
};
|
|
31
|
-
const buildMaskPlugin = {
|
|
32
|
-
id: "build-mask-plugin",
|
|
33
|
-
canHandle: (node) => typeof node === "string" || typeof node === "number",
|
|
34
|
-
transform: () => true
|
|
35
|
-
};
|
|
36
|
-
const buildMask = (source) => ({
|
|
37
|
-
...source,
|
|
38
|
-
content: (0, import_core.deepTransformNode)(source.content, {
|
|
39
|
-
dictionaryKey: source.key,
|
|
40
|
-
keyPath: [],
|
|
41
|
-
plugins: [passTypedNodePlugin, buildMaskPlugin]
|
|
42
|
-
})
|
|
43
|
-
});
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
buildMask,
|
|
47
|
-
buildMaskPlugin
|
|
48
|
-
});
|
|
49
|
-
//# sourceMappingURL=buildMask.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/reduceDictionaryContent/buildMask.ts"],"sourcesContent":["import { deepTransformNode, Dictionary, type Plugins } from '@intlayer/core';\n\nconst passTypedNodePlugin: Plugins = {\n id: 'pass-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof node?.nodeType === 'string',\n transform: (node, props, deepTransformNode) =>\n deepTransformNode(node[node.nodeType], props),\n};\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const buildMaskPlugin: Plugins = {\n id: 'build-mask-plugin',\n canHandle: (node) => typeof node === 'string' || typeof node === 'number',\n transform: () => true,\n};\n\nexport const buildMask = (source: Dictionary): any => ({\n ...source,\n content: deepTransformNode(source.content, {\n dictionaryKey: source.key,\n keyPath: [],\n plugins: [passTypedNodePlugin, buildMaskPlugin],\n }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA4D;AAE5D,MAAM,sBAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,OAAO,MAAM,aAAa;AAAA,EACxD,WAAW,CAAC,MAAM,OAAOA,uBACvBA,mBAAkB,KAAK,KAAK,QAAQ,GAAG,KAAK;AAChD;AAGO,MAAM,kBAA2B;AAAA,EACtC,IAAI;AAAA,EACJ,WAAW,CAAC,SAAS,OAAO,SAAS,YAAY,OAAO,SAAS;AAAA,EACjE,WAAW,MAAM;AACnB;AAEO,MAAM,YAAY,CAAC,YAA6B;AAAA,EACrD,GAAG;AAAA,EACH,aAAS,+BAAkB,OAAO,SAAS;AAAA,IACzC,eAAe,OAAO;AAAA,IACtB,SAAS,CAAC;AAAA,IACV,SAAS,CAAC,qBAAqB,eAAe;AAAA,EAChD,CAAC;AACH;","names":["deepTransformNode"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/dictionary_to_main/createDictionaryEntryPoint.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { mkdir } from 'fs/promises';\nimport { resolve } from 'path';\nimport { getBuiltDictionariesPath } from '../../getBuiltDictionariesPath';\nimport { getBuiltDynamicDictionariesPath } from '../../getBuiltDynamicDictionariesPath';\nimport { getBuiltFetchDictionariesPath } from '../../getBuiltFetchDictionariesPath';\nimport { getBuiltRemoteDictionariesPath } from '../../getBuiltRemoteDictionariesPath';\nimport { getBuiltUnmergedDictionariesPath } from '../../getBuiltUnmergedDictionariesPath';\nimport { parallelize } from '../../utils/parallelize';\nimport { writeFileIfChanged } from '../../writeFileIfChanged';\nimport { generateDictionaryListContent } from './generateDictionaryListContent';\n\nconst filterDictionaries = (paths: string[], keys?: string[]) => {\n if (!keys) return paths;\n return paths.filter((path) =>\n keys.some((key) => path.endsWith(`${key}.json`))\n );\n};\n\nconst writeDictionaryFiles = async (\n paths: string[],\n fileName: string,\n functionName: string,\n format: 'cjs' | 'esm',\n configuration = getConfiguration()\n) => {\n const content = generateDictionaryListContent(\n paths,\n functionName,\n format,\n configuration\n );\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const { mainDir } = configuration.content;\n\n await writeFileIfChanged(\n resolve(mainDir, `${fileName}.${extension}`),\n content\n );\n};\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const createDictionaryEntryPoint = async (\n configuration = getConfiguration(),\n dictionariesKeys?: string[],\n formats?: ('cjs' | 'esm')[]\n) => {\n const outputFormats = formats ?? configuration.build.outputFormat;\n const { mainDir } = configuration.content;\n\n await mkdir(mainDir, { recursive: true });\n\n const remoteDictionariesPath = getBuiltRemoteDictionariesPath(configuration);\n const dictionariesPath = filterDictionaries(\n getBuiltDictionariesPath(configuration),\n dictionariesKeys\n );\n const unmergedDictionariesPath =\n getBuiltUnmergedDictionariesPath(configuration);\n\n const writeOperations = [\n ...outputFormats.map((format) => ({\n paths: remoteDictionariesPath,\n functionName: 'getRemoteDictionaries',\n fileName: 'remote_dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: dictionariesPath,\n functionName: 'getDictionaries',\n fileName: 'dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: unmergedDictionariesPath,\n functionName: 'getUnmergedDictionaries',\n fileName: 'unmerged_dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: getBuiltDynamicDictionariesPath(configuration, format),\n functionName: 'getDynamicDictionaries',\n fileName: 'dynamic_dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: getBuiltFetchDictionariesPath(configuration, format),\n functionName: 'getFetchDictionaries',\n fileName: 'fetch_dictionaries' as const,\n format,\n })),\n ];\n\n await parallelize(\n writeOperations,\n async ({ paths, fileName, format, functionName }) =>\n writeDictionaryFiles(paths, fileName, functionName, format, configuration)\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AACjC,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EAAE;AAAA,IACF,GAAG,cAAc,IAAI,CAAC,YAAY;AAAA,MAChC,OAAO;AAAA,MACP,cAAc;AAAA,MACd,UAAU;AAAA,MACV;AAAA,IACF,EAAE;AAAA,IACF,GAAG,cAAc,IAAI,CAAC,YAAY;AAAA,MAChC,WAAO,wEAAgC,eAAe,MAAM;AAAA,MAC5D,cAAc;AAAA,MACd,UAAU;AAAA,MACV;AAAA,IACF,EAAE;AAAA,IACF,GAAG,cAAc,IAAI,CAAC,YAAY;AAAA,MAChC,WAAO,oEAA8B,eAAe,MAAM;AAAA,MAC1D,cAAc;AAAA,MACd,UAAU;AAAA,MACV;AAAA,IACF,EAAE;AAAA,EACJ;AAEA,YAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,OAAO,UAAU,QAAQ,aAAa,MAC7C,qBAAqB,OAAO,UAAU,cAAc,QAAQ,aAAa;AAAA,EAC7E;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/dictionary_to_main/generateDictionaryListContent.ts"],"sourcesContent":["import { getConfiguration, normalizePath } from '@intlayer/config';\nimport { basename, extname, relative } from 'path';\nimport { getFileHash } from '../../utils/getFileHash';\n\n/**\n * This function generates the content of the dictionary list file\n */\nexport const generateDictionaryListContent = (\n dictionaries: string[],\n functionName: string,\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { mainDir } = configuration.content;\n\n let content = '';\n\n const dictionariesRef = dictionaries.map((dictionaryPath) => ({\n relativePath: normalizePath(relative(mainDir, dictionaryPath)),\n id: basename(dictionaryPath, extname(dictionaryPath)), // Get the base name as the dictionary id\n hash: `_${getFileHash(dictionaryPath)}`, // Get the hash of the dictionary to avoid conflicts\n }));\n\n // Import all dictionaries\n dictionariesRef.forEach((dictionary) => {\n if (format === 'esm')\n content += `import ${dictionary.hash} from '${dictionary.relativePath}' with { type: 'json' };\\n`;\n if (format === 'cjs')\n content += `const ${dictionary.hash} = require('${dictionary.relativePath}');\\n`;\n });\n\n content += '\\n';\n\n // Format Dictionary Map\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": ${dictionary.hash}`)\n .join(',\\n');\n\n content += `const dictionaries = {\\n${formattedDictionaryMap}\\n};\\n`;\n content += `const ${functionName} = () => dictionaries;\\n`;\n\n if (format === 'esm') {\n content += `\\n`;\n content += `export { ${functionName} };\\n`;\n content += `export default dictionaries;\\n`;\n }\n\n if (format === 'cjs') {\n content += `\\n`;\n content += `module.exports.${functionName} = ${functionName};\\n`;\n content += `module.exports = dictionaries;\\n`;\n }\n\n return content;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAgD;AAChD,kBAA4C;AAC5C,yBAA4B;AAKrB,MAAM,gCAAgC,CAC3C,cACA,cACA,SAAwB,OACxB,oBAAgB,gCAAiB,MACtB;AACX,QAAM,EAAE,QAAQ,IAAI,cAAc;AAElC,MAAI,UAAU;AAEd,QAAM,kBAAkB,aAAa,IAAI,CAAC,oBAAoB;AAAA,IAC5D,kBAAc,iCAAc,sBAAS,SAAS,cAAc,CAAC;AAAA,IAC7D,QAAI,sBAAS,oBAAgB,qBAAQ,cAAc,CAAC;AAAA;AAAA,IACpD,MAAM,QAAI,gCAAY,cAAc,CAAC;AAAA;AAAA,EACvC,EAAE;AAGF,kBAAgB,QAAQ,CAAC,eAAe;AACtC,QAAI,WAAW;AACb,iBAAW,UAAU,WAAW,IAAI,UAAU,WAAW,YAAY;AAAA;AACvE,QAAI,WAAW;AACb,iBAAW,SAAS,WAAW,IAAI,eAAe,WAAW,YAAY;AAAA;AAAA,EAC7E,CAAC;AAED,aAAW;AAGX,QAAM,yBAAiC,gBACpC,IAAI,CAAC,eAAe,MAAM,WAAW,EAAE,MAAM,WAAW,IAAI,EAAE,EAC9D,KAAK,KAAK;AAEb,aAAW;AAAA,EAA2B,sBAAsB;AAAA;AAAA;AAC5D,aAAW,SAAS,YAAY;AAAA;AAEhC,MAAI,WAAW,OAAO;AACpB,eAAW;AAAA;AACX,eAAW,YAAY,YAAY;AAAA;AACnC,eAAW;AAAA;AAAA,EACb;AAEA,MAAI,WAAW,OAAO;AACpB,eAAW;AAAA;AACX,eAAW,kBAAkB,YAAY,MAAM,YAAY;AAAA;AAC3D,eAAW;AAAA;AAAA,EACb;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var dictionary_to_main_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(dictionary_to_main_exports);
|
|
18
|
-
__reExport(dictionary_to_main_exports, require('./createDictionaryEntryPoint.cjs'), module.exports);
|
|
19
|
-
__reExport(dictionary_to_main_exports, require('./generateDictionaryListContent.cjs'), module.exports);
|
|
20
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
-
0 && (module.exports = {
|
|
22
|
-
...require('./createDictionaryEntryPoint.cjs'),
|
|
23
|
-
...require('./generateDictionaryListContent.cjs')
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/dictionary_to_main/index.ts"],"sourcesContent":["export * from './createDictionaryEntryPoint';\nexport * from './generateDictionaryListContent';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uCAAc,yCAAd;AACA,uCAAc,4CADd;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createModuleAugmentation.ts"],"sourcesContent":["import { Locales, getConfiguration, normalizePath } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport { mkdir } from 'fs/promises';\nimport { basename, extname, join, relative } from 'path';\nimport { getFileHash } from '../../utils/getFileHash';\nimport { kebabCaseToCamelCase } from '../../utils/kebabCaseToCamelCase';\nimport { writeFileIfChanged } from '../../writeFileIfChanged';\n\nexport const getTypeName = (key: string): string =>\n `${kebabCaseToCamelCase(key)}Content`;\n\nconst formatLocales = (locales: Locales[]): string =>\n locales\n .map((locale) => {\n for (const key in Locales) {\n if (Locales[key as keyof typeof Locales] === locale) {\n return `Locales.${key}`;\n }\n }\n })\n .join(' | ');\n\n/**\n * This function generates the content of the module augmentation file\n */\nconst generateTypeIndexContent = (\n typeFiles: string[],\n configuration = getConfiguration()\n): string => {\n const { content, internationalization } = configuration;\n const { moduleAugmentationDir } = content;\n const { locales, requiredLocales, strictMode } = internationalization;\n\n let fileContent =\n \"/* eslint-disable */\\nimport { Locales } from 'intlayer';\\n\";\n\n const dictionariesRef = typeFiles.map((dictionaryPath) => ({\n relativePath: `./${relative(moduleAugmentationDir, dictionaryPath)}`,\n id: basename(dictionaryPath, extname(dictionaryPath)), // Get the base name as the dictionary id (without the extension)\n hash: `_${getFileHash(dictionaryPath)}`, // Get the hash of the dictionary to avoid conflicts\n }));\n\n // Import all dictionaries\n dictionariesRef.forEach((dictionary) => {\n fileContent += `import ${dictionary.hash} from '${dictionary.relativePath}';\\n`;\n });\n\n fileContent += '\\n';\n\n // Format Dictionary Map\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": typeof ${dictionary.hash};`)\n .join('\\n');\n\n const requiredLocalesValues =\n requiredLocales.length > 0\n ? requiredLocales.filter((locale) =>\n locales.map((locale) => String(locale)).includes(String(locale))\n )\n : locales;\n\n const formattedLocales = formatLocales(locales);\n const formattedRequiredLocales = formatLocales(requiredLocalesValues);\n\n const strictModeRecord =\n strictMode === 'strict'\n ? `interface IConfigLocales<Content> extends Record<DeclaredLocales, Content> {}`\n : strictMode === 'inclusive'\n ? `interface IConfigLocales<Content> extends Record<ExtractedLocales, Content>, Partial<Record<ExcludedLocales, Content>> {}`\n : `interface IConfigLocales<Content> extends Partial<Record<Locales, Content>> {}`;\n\n /**\n * Write the module augmentation to extend the intlayer module with the dictionaries types\n * Will suggest the type resulting of the dictionaries\n *\n * declare module 'intlayer' {\n * interface IntlayerDictionaryTypesConnector = {\n * dictionaries: {\n * id: DictionaryType;\n * }\n * }\n *\n * type ConfigLocales = Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH;\n * type ExtractedLocales = Extract<Locales, ConfigLocales>;\n *\n * interface IConfigLocales<Content> extends Record<ExtractedLocales, Content>, Partial<Record<ExcludedLocales, Content>> {}\n *\n *\n * }\n * See https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation\n */\n fileContent += `declare module 'intlayer' {\\n`;\n fileContent += ` interface IntlayerDictionaryTypesConnector {\\n${formattedDictionaryMap}\\n }\\n\\n`;\n fileContent += ` type DeclaredLocales = ${formattedLocales};\\n`;\n fileContent += ` type RequiredLocales = ${formattedRequiredLocales};\\n`;\n fileContent += ` type ExtractedLocales = Extract<Locales, RequiredLocales>;\\n`;\n fileContent += ` type ExcludedLocales = Exclude<Locales, RequiredLocales>;\\n`;\n fileContent += ` ${strictModeRecord}\\n`;\n fileContent += `}`;\n\n return fileContent;\n};\n\n/**\n * This function generates a index file merging all the types\n */\nexport const createModuleAugmentation = async (\n configuration = getConfiguration()\n) => {\n const { moduleAugmentationDir, typesDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n await mkdir(moduleAugmentationDir, { recursive: true });\n\n const dictionariesTypesDefinitions: string[] = fg.sync(\n normalizePath(`${typesDir}/*.ts`),\n {\n ignore: ['**/*.d.ts'],\n }\n );\n\n // Create the dictionary list file\n const tsContent = generateTypeIndexContent(dictionariesTypesDefinitions);\n\n const tsFilePath = join(moduleAugmentationDir, 'intlayer.d.ts');\n\n await writeFileIfChanged(tsFilePath, tsContent);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyD;AACzD,uBAAe;AACf,sBAAsB;AACtB,kBAAkD;AAClD,yBAA4B;AAC5B,kCAAqC;AACrC,gCAAmC;AAE5B,MAAM,cAAc,CAAC,QAC1B,OAAG,kDAAqB,GAAG,CAAC;AAE9B,MAAM,gBAAgB,CAAC,YACrB,QACG,IAAI,CAAC,WAAW;AACf,aAAW,OAAO,uBAAS;AACzB,QAAI,sBAAQ,GAA2B,MAAM,QAAQ;AACnD,aAAO,WAAW,GAAG;AAAA,IACvB;AAAA,EACF;AACF,CAAC,EACA,KAAK,KAAK;AAKf,MAAM,2BAA2B,CAC/B,WACA,oBAAgB,gCAAiB,MACtB;AACX,QAAM,EAAE,SAAS,qBAAqB,IAAI;AAC1C,QAAM,EAAE,sBAAsB,IAAI;AAClC,QAAM,EAAE,SAAS,iBAAiB,WAAW,IAAI;AAEjD,MAAI,cACF;AAEF,QAAM,kBAAkB,UAAU,IAAI,CAAC,oBAAoB;AAAA,IACzD,cAAc,SAAK,sBAAS,uBAAuB,cAAc,CAAC;AAAA,IAClE,QAAI,sBAAS,oBAAgB,qBAAQ,cAAc,CAAC;AAAA;AAAA,IACpD,MAAM,QAAI,gCAAY,cAAc,CAAC;AAAA;A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{"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createType.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n getConfiguration,\n IntlayerConfig,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { resolve } from 'path';\nimport { parallelize } from '../../utils/parallelize';\n\nconst requireUncached = (module: string) => {\n delete ESMxCJSRequire.cache[ESMxCJSRequire.resolve(module)];\n return ESMxCJSRequire(module);\n};\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2);\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = async (\n dictionariesPaths: string[],\n configuration: IntlayerConfig = getConfiguration()\n): Promise<string[]> => {\n const { typesDir } = configuration.content;\n\n // Create type folders if they don't exist\n await mkdir(typesDir, { recursive: true });\n\n const results = await parallelize(\n dictionariesPaths,\n async (dictionaryPath): Promise<string | undefined> => {\n const dictionary: Dictionary = requireUncached(dictionaryPath);\n\n if (!dictionary.key) {\n return undefined;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n await writeFile(outputPath, typeDefinition);\n\n return outputPath;\n }\n );\n\n return results.filter(Boolean) as string[];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAIO;AAEP,sBAAiC;AACjC,kBAAwB;AACxB,yBAA4B;AAE5B,MAAM,kBAAkB,CAACA,YAAmB;AAC1C,SAAO,6BAAe,MAAM,6BAAe,QAAQA,OAAM,CAAC;AAC1D,aAAO,8BAAeA,OAAM;AAC9B;AAEO,MAAM,yBAAyB,CAAC,eAA2B;AAChE,QAAM,aAAa,KAAK,UAAU,YAAY,MAAM,CAAC;AAErD,SAAO;AAAA,iBAAwC,UAAU;AAAA;AAC3D;AAIO,MAAM,cAAc,OACzB,mBACA,oBAAgC,gCAAiB,MAC3B;AACtB,QAAM,EAAE,SAAS,IAAI,cAAc;AAGnC,YAAM,uBAAM,UAAU,EAAE,WAAW,KAAK,CAAC;AAEzC,QAAM,UAAU,UAAM;AAAA,IACpB;AAAA,IACA,OAAO,mBAAgD;AACrD,YAAM,aAAyB,gBAAgB,cAAc;AAE7D,UAAI,CAAC,WAAW,KAAK;AACnB,eAAO;AAAA,MACT;AAEA,YAAM,iBAAyB,uBAAuB,UAAU;AAEhE,YAAM,iBAAqB,qBAAQ,UAAU,GAAG,WAAW,GAAG,KAAK;AAEnE,gBAAM,2BAAU,YAAY,cAAc;AAE1C,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,QAAQ,OAAO,OAAO;AAC/B;","names":["module"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/index.ts"],"sourcesContent":["export * from './createModuleAugmentation';\nexport * from './createType';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uCAAc,uCAAd;AACA,uCAAc,yBADd;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/intlayer_dictionary/buildIntlayerDictionary.ts"],"sourcesContent":["// @ts-ignore: @intlayer/backend is not built yet\nimport { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport {\n LocalizedDictionaryOutput,\n writeDynamicDictionary,\n} from './writeDynamicDictionary';\nimport { writeFetchDictionary } from './writeFetchDictionary';\nimport { writeMergedDictionaries } from './writeMergedDictionary';\nimport { writeUnmergedDictionaries } from './writeUnmergedDictionary';\n\n/**\n * This function transpile the bundled code to to make dictionaries as JSON files\n */\nexport const buildDictionary = async (\n localDictionariesEntries: Dictionary[],\n configuration = getConfiguration(),\n formats: ('cjs' | 'esm')[] = ['cjs', 'esm']\n) => {\n const { importMode } = configuration.build;\n\n const unmergedDictionaries = await writeUnmergedDictionaries(\n localDictionariesEntries,\n configuration\n );\n\n const mergedDictionaries = await writeMergedDictionaries(\n unmergedDictionaries,\n configuration\n );\n\n let dynamicDictionaries: LocalizedDictionaryOutput | null = null;\n\n if (importMode === 'dynamic' || importMode === 'live') {\n dynamicDictionaries = await writeDynamicDictionary(\n mergedDictionaries,\n configuration,\n formats\n );\n }\n\n let fetchDictionaries: LocalizedDictionaryOutput | null = null;\n\n if (importMode === 'live') {\n fetchDictionaries = await writeFetchDictionary(\n dynamicDictionaries!,\n configuration,\n formats\n );\n }\n\n return {\n unmergedDictionaries,\n mergedDictionaries,\n dynamicDictionaries,\n fetchDictionaries,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAiC;AAEjC,oCAGO;AACP,kCAAqC;AACrC,mCAAwC;AACxC,qCAA0C;AAKnC,MAAM,kBAAkB,OAC7B,0BACA,oBAAgB,gCAAiB,GACjC,UAA6B,CAAC,OAAO,KAAK,MACvC;AACH,QAAM,EAAE,WAAW,IAAI,cAAc;AAErC,QAAM,uBAAuB,UAAM;AAAA,IACjC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,qBAAqB,UAAM;AAAA,IAC/B;AAAA,IACA;AAAA,EACF;AAEA,MAAI,sBAAwD;AAE5D,MAAI,eAAe,aAAa,eAAe,QAAQ;AACrD,0BAAsB,UAAM;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,MAAI,oBAAsD;AAE1D,MAAI,eAAe,QAAQ;AACzB,wBAAoB,UAAM;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/intlayer_dictionary/index.ts"],"sourcesContent":["export * from './buildIntlayerDictionary';\nexport * from './processContentDeclaration';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wCAAc,sCAAd;AACA,wCAAc,wCADd;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/intlayer_dictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/core';\nimport { resolveObjectPromises } from '../../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary\n): Promise<Dictionary | undefined> => {\n try {\n const content = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n return {\n ...contentDeclaration,\n content,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAEvB,mCAAsC;AAK/B,MAAM,4BAA4B,OACvC,uBACoC;AACpC,MAAI;AACF,UAAM,UAAW,UAAM;AAAA,MACrB,mBAAmB;AAAA,IACrB;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,8BAAO,OAAO;AAAA,MACZ,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/intlayer_dictionary/writeDynamicDictionary.ts"],"sourcesContent":["import {\n colorizePath,\n getConfiguration,\n Locales,\n normalizePath,\n} from '@intlayer/config';\nimport { getLocalisedContent, type Dictionary } from '@intlayer/core';\nimport { mkdir } from 'fs/promises';\nimport { relative, resolve } from 'path';\nimport { parallelize } from '../../utils/parallelize';\nimport { writeFileIfChanged } from '../../writeFileIfChanged';\nimport { writeJsonIfChanged } from '../../writeJsonIfChanged';\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 // The following filter/sort preserve determinism of the generated map\n // when files are built in parallel or across different Node versions.\n .filter((entry): entry is [string, DictionaryResult] => Boolean(entry[1]))\n .sort(([a], [b]) => String(a).localeCompare(String(b)))\n .map(([locale, dictionary]) => {\n const relativePath = normalizePath(\n relative(dynamicDictionariesDir, dictionary.dictionaryPath)\n );\n\n if (format === 'esm') {\n return ` '${locale}': () => import('./${relativePath}', { assert: { type: 'json' }}).then(mod => mod.default)`;\n }\n\n return ` '${locale}': () => Promise.resolve(require('./${relativePath}'))`;\n })\n .join(',\\n');\n\n content += `const content = {\\n${formattedDictionaryMap}\\n};\\n`;\n\n if (format === 'esm') content += `export default content;\\n`;\n if (format === 'cjs') content += `module.exports = content;\\n`;\n\n return content;\n};\n\n/**\n * Write the localized dictionaries to the dictionariesDir\n * @param mergedDictionaries - The merged dictionaries\n * @param configuration - The configuration\n * @returns The final dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/dynamic_dictionaries/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeDynamicDictionary = async (\n mergedDictionaries: MergedDictionaryOutput,\n configuration = getConfiguration(),\n formats: ('cjs' | 'esm')[] = ['cjs', 'esm']\n): Promise<LocalizedDictionaryOutput> => {\n const { locales, defaultLocale } = configuration.internationalization;\n const { dynamicDictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dynamicDictionariesDir), { recursive: true });\n\n let resultDictionariesPaths: LocalizedDictionaryOutput = {};\n\n // Merge dictionaries with the same key and write to dictionariesDir\n await parallelize(\n Object.entries(mergedDictionaries).sort(([a], [b]) =>\n String(a).localeCompare(String(b))\n ),\n async ([key, dictionaryEntry]) => {\n if (key === 'undefined') return;\n\n let localedDictionariesPathsRecord: LocalizedDictionaryResult = {};\n\n await parallelize(locales, async (locale) => {\n const localizedDictionary = {\n ...dictionaryEntry.dictionary,\n locale,\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n content: getLocalisedContent(\n JSON.parse(JSON.stringify(dictionaryEntry.dictionary.content)),\n locale,\n { dictionaryKey: key, keyPath: [] },\n defaultLocale\n ) as any,\n };\n\n const outputFileName = `${key}.${locale}.json`;\n const resultFilePath = resolve(dynamicDictionariesDir, outputFileName);\n\n // Write the localized dictionary\n await writeJsonIfChanged(resultFilePath, localizedDictionary).catch(\n (err) => {\n console.error(`Error creating localized ${outputFileName}:`, err);\n }\n );\n\n localedDictionariesPathsRecord[locale] = {\n dictionaryPath: resultFilePath,\n dictionary: localizedDictionary,\n };\n });\n\n resultDictionariesPaths[key] = localedDictionariesPathsRecord;\n\n await parallelize(formats, async (format) => {\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n const content = generateDictionaryEntryPoint(\n localedDictionariesPathsRecord,\n format,\n configuration\n );\n\n await writeFileIfChanged(\n resolve(dynamicDictionariesDir, `${key}.${extension}`),\n content\n ).catch((err) => {\n console.error(\n `Error creating dynamic ${colorizePath(resolve(dynamicDictionariesDir, `${key}.${extension}`))}:`,\n err\n );\n });\n });\n }\n );\n\n return resultDictionariesPaths;\n};\n"],"mappings":";;;;;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H;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/transpiler/intlayer_dictionary/writeFetchDictionary.ts"],"sourcesContent":["import {\n colorizePath,\n getConfiguration,\n normalizePath,\n} from '@intlayer/config';\nimport { mkdir } from 'fs/promises';\nimport { relative, resolve } from 'path';\nimport { parallelize } from '../../utils/parallelize';\nimport { writeFileIfChanged } from '../../writeFileIfChanged';\nimport type {\n LocalizedDictionaryOutput,\n LocalizedDictionaryResult,\n} from './writeDynamicDictionary';\n\n/**\n * This function generates the content of the dictionary list file\n */\nexport const generateDictionaryEntryPoint = (\n localedDictionariesPathsRecord: LocalizedDictionaryResult,\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { fetchDictionariesDir } = configuration.content;\n const { liveSyncURL } = configuration.editor;\n\n let content = '';\n\n const formattedDictionaryMap: string = Object.entries(\n localedDictionariesPathsRecord\n )\n .map(([locale, dictionary]) => {\n const relativePath = normalizePath(\n relative(fetchDictionariesDir, dictionary.dictionaryPath)\n );\n\n if (format === 'esm') {\n return ` '${locale}': () => (async () => { try {return await fetch('${liveSyncURL}/dictionaries/${dictionary.dictionary.key}/${locale}').then(res => res.json())} catch (_error) {return await import('./${relativePath}', { assert: { type: 'json' }}).then(mod => mod.default)}})()`;\n }\n\n return ` '${locale}': () => (async () => { try {return await fetch('${liveSyncURL}/dictionaries/${dictionary.dictionary.key}/${locale}').then(res => res.json())} catch (_error) {return Promise.resolve(require('./${relativePath}'))}})()`;\n })\n .join(',\\n');\n\n content += `const content = {\\n${formattedDictionaryMap}\\n};\\n`;\n\n if (format === 'esm') content += `export default content;\\n`;\n if (format === 'cjs') content += `module.exports = content;\\n`;\n\n return content;\n};\n\n/**\n * Write the localized dictionaries to the dictionariesDir\n * @param mergedDictionaries - The merged dictionaries\n * @param configuration - The configuration\n * @returns The final dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);\n * console.log(finalDictionaries);\n *\n * // .intlayer/fetch_dictionaries/home.json\n * // { key: 'home', content: { ... } },\n * ```\n */\nexport const writeFetchDictionary = async (\n dynamicDictionaries: LocalizedDictionaryOutput,\n configuration = getConfiguration(),\n formats: ('cjs' | 'esm')[] = ['cjs', 'esm']\n): Promise<LocalizedDictionaryOutput> => {\n const { fetchDictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(fetchDictionariesDir), { recursive: true });\n\n let resultDictionariesPaths: LocalizedDictionaryOutput = {};\n\n // Write entry points for each dictionary in parallel\n await parallelize(\n Object.entries(dynamicDictionaries),\n async ([key, localedDictionariesPathsRecord]) => {\n if (key === 'undefined') return;\n\n await parallelize(formats, async (format) => {\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n const content = generateDictionaryEntryPoint(\n localedDictionariesPathsRecord,\n format,\n configuration\n );\n\n await writeFileIfChanged(\n resolve(fetchDictionariesDir, `${key}.${extension}`),\n content\n ).catch((err) => {\n console.error(\n `Error creating fetch ${colorizePath(resolve(fetchDictionariesDir, `${key}.${extension}`))}:`,\n err\n );\n });\n });\n }\n );\n\n return resultDictionariesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAIO;AACP,sBAAsB;AACtB,kBAAkC;AAClC,yBAA4B;AAC5B,gCAAmC;AAS5B,MAAM,+BAA+B,CAC1C,gCACA,SAAwB,OACxB,oBAAgB,gCAAiB,MACtB;AACX,QAAM,EAAE,qBAAqB,IAAI,cAAc;AAC/C,QAAM,EAAE,YAAY,IAAI,cAAc;AAEtC,MAAI,UAAU;AAEd,QAAM,yBAAiC,OAAO;AAAA,IAC5C;AAAA,EACF,EACG,IAAI,CAAC,CAAC,QAAQ,UAAU,MAAM;AAC7B,UAAM,mBAAe;AAAA,UACnB,sB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}
|
|
@@ -1 +0,0 @@
|
|
|
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;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAE/C,sBAAsB;AACtB,kBAAwB;AACxB,+BAAkC;AAClC,wCAA2C;AAC3C,yBAA4B;AAC5B,gCAAmC;AA0B5B,MAAM,0BAA0B,OACrC,qBACA,oBAAgB,gCAAiB,MACG;AACpC,QAAM,EAAE,gBAAgB,IAAI,cAAc;AAG1C,YAAM,2BAAM,qBAAQ,eAAe,GAAG,EAAE,WAAW,KAAK,CAAC;AAEzD,QAAM,UAAU,UAAM;AAAA,IACpB,OAAO,QAAQ,mBAAmB;AAAA,IAClC,OAAO,CAAC,KAAK,iBAAiB,MAAM;AAClC,UAAI,QAAQ,aAAa;AACvB,eAAO;AAAA,MAIT;AAEA,YAAM,0BAA0B,kBAAkB,aAAa;AAAA,QAC7D,CAAC,mBAAe,8DAA2B,UAAU;AAAA,MACvD;AAEA,YAAM,uBAAmB,4CAAkB,uBAAuB;AAElE,YAAM,iBAAiB,GAAG,GAAG;AAC7B,YAAM,qBAAiB,qBAAQ,iBAAiB,cAAc;AAG9D,gBAAM,8CAAmB,gBAAgB,gBAAgB,EAAE;AAAA,QACzD,CAAC,QAAQ;AACP,kBAAQ;AAAA,YACN,6BAAyB,4BAAa,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 +0,0 @@
|
|
|
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;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAE/C,sBAAsB;AACtB,kBAAwB;AACxB,uCAA0C;AAC1C,8BAA0C;AAC1C,yBAA4B;AAC5B,gCAAmC;AAkB5B,MAAM,wBAAwB,OACnC,oBACA,oBAAgB,gCAAiB,MACP;AAC1B,QAAM,EAAE,sBAAsB,IAAI,cAAc;AAGhD,YAAM,2BAAM,qBAAQ,qBAAqB,GAAG,EAAE,WAAW,KAAK,CAAC;AAE/D,QAAM,2BAAuB,4DAA0B,kBAAkB;AAGzE,YAAM;AAAA,IACJ,qBAAqB,OAAO,CAAC,eAAe,WAAW,QAAQ,WAAW;AAAA,IAC1E,OAAO,eAAe;AACpB,YAAM,iBAAiB,GAAG,WAAW,GAAG;AACxC,YAAM,qBAAiB,qBAAQ,uBAAuB,cAAc;AAGpE,gBAAM,8CAAmB,gBAAgB,UAAU,EAAE,MAAM,CAAC,QAAQ;AAClE,gBAAQ;AAAA,UACN,6BAAyB,4BAAa,cAAc,CAAC;AAAA,UACrD;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,aAAO,mDAA0B,kBAAkB;AACrD;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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 );\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AA,EACF;AAEA,SAAO,OAAO;AAAA,IACZ,QAAQ,OAAO,OAAO;AAAA,EAGxB;AACF;","names":["dictionaries"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/chokidar/index.ts"],"sourcesContent":["export * from './watcher';\n"],"mappings":"AAAA,cAAc;","names":[]}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getAppLogger,
|
|
3
|
-
getConfiguration
|
|
4
|
-
} from "@intlayer/config";
|
|
5
|
-
import { basename } from "path";
|
|
6
|
-
import { watch as chokidarWatch } from "chokidar";
|
|
7
|
-
import { getBuiltDictionariesPath } from "../getBuiltDictionariesPath.mjs";
|
|
8
|
-
import { listDictionaries } from "../listDictionariesPath.mjs";
|
|
9
|
-
import { loadLocalDictionaries } from "../loadDictionaries/loadLocalDictionaries.mjs";
|
|
10
|
-
import { prepareIntlayer } from "../prepareIntlayer.mjs";
|
|
11
|
-
import { createDictionaryEntryPoint } from "../transpiler/dictionary_to_main/createDictionaryEntryPoint.mjs";
|
|
12
|
-
import {
|
|
13
|
-
createModuleAugmentation,
|
|
14
|
-
createTypes
|
|
15
|
-
} from "../transpiler/dictionary_to_type/index.mjs";
|
|
16
|
-
import { buildDictionary } from "../transpiler/intlayer_dictionary/buildIntlayerDictionary.mjs";
|
|
17
|
-
import { formatPath } from "../utils/formatter.mjs";
|
|
18
|
-
const recentlyAddedFiles = /* @__PURE__ */ new Set();
|
|
19
|
-
const handleAdditionalContentDeclarationFile = async (filePath, configuration) => {
|
|
20
|
-
const config = configuration ?? getConfiguration();
|
|
21
|
-
const appLogger = getAppLogger(config);
|
|
22
|
-
appLogger(`Additional file detected: ${formatPath(filePath)}`, {
|
|
23
|
-
isVerbose: true
|
|
24
|
-
});
|
|
25
|
-
const localeDictionaries = await loadLocalDictionaries(filePath);
|
|
26
|
-
const dictionariesOutput = await buildDictionary(localeDictionaries, config);
|
|
27
|
-
const dictionariesPaths = Object.values(
|
|
28
|
-
dictionariesOutput?.mergedDictionaries ?? {}
|
|
29
|
-
).map((dictionary) => dictionary.dictionaryPath);
|
|
30
|
-
await createTypes(dictionariesPaths);
|
|
31
|
-
await createDictionaryEntryPoint();
|
|
32
|
-
appLogger("Dictionaries built", {
|
|
33
|
-
isVerbose: true
|
|
34
|
-
});
|
|
35
|
-
createModuleAugmentation();
|
|
36
|
-
appLogger("Module augmentation built", {
|
|
37
|
-
isVerbose: true
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
const handleUnlikedContentDeclarationFile = async (filePath, configuration) => {
|
|
41
|
-
const config = configuration ?? getConfiguration();
|
|
42
|
-
const appLogger = getAppLogger(config);
|
|
43
|
-
appLogger(`Unlinked detected: ${formatPath(filePath)}`, {
|
|
44
|
-
isVerbose: true
|
|
45
|
-
});
|
|
46
|
-
const files = listDictionaries(configuration);
|
|
47
|
-
const localeDictionaries = await loadLocalDictionaries(files);
|
|
48
|
-
const dictionariesOutput = await buildDictionary(localeDictionaries, config);
|
|
49
|
-
const dictionariesPaths = Object.values(
|
|
50
|
-
dictionariesOutput?.mergedDictionaries ?? {}
|
|
51
|
-
).map((dictionary) => dictionary.dictionaryPath);
|
|
52
|
-
await createTypes(dictionariesPaths);
|
|
53
|
-
await createDictionaryEntryPoint();
|
|
54
|
-
appLogger("Dictionaries rebuilt", {
|
|
55
|
-
isVerbose: true
|
|
56
|
-
});
|
|
57
|
-
await createModuleAugmentation();
|
|
58
|
-
appLogger("Module augmentation built", {
|
|
59
|
-
isVerbose: true
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
const handleContentDeclarationFileChange = async (filePath, configuration) => {
|
|
63
|
-
const config = configuration ?? getConfiguration();
|
|
64
|
-
const appLogger = getAppLogger(config);
|
|
65
|
-
appLogger(`Change detected: ${formatPath(filePath)}`, {
|
|
66
|
-
isVerbose: true
|
|
67
|
-
});
|
|
68
|
-
const localeDictionaries = await loadLocalDictionaries(filePath);
|
|
69
|
-
const dictionariesOutput = await buildDictionary(localeDictionaries, config);
|
|
70
|
-
const updatedDictionariesPaths = Object.values(
|
|
71
|
-
dictionariesOutput?.mergedDictionaries ?? {}
|
|
72
|
-
).map((dictionary) => dictionary.dictionaryPath);
|
|
73
|
-
const allDictionariesPaths = getBuiltDictionariesPath();
|
|
74
|
-
createTypes(updatedDictionariesPaths);
|
|
75
|
-
appLogger("TypeScript types built", {
|
|
76
|
-
isVerbose: true
|
|
77
|
-
});
|
|
78
|
-
if (updatedDictionariesPaths.some(
|
|
79
|
-
(updatedDictionaryPath) => !allDictionariesPaths.includes(updatedDictionaryPath)
|
|
80
|
-
)) {
|
|
81
|
-
await createDictionaryEntryPoint();
|
|
82
|
-
appLogger("Dictionary list built", {
|
|
83
|
-
isVerbose: true
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
const watch = (options) => {
|
|
88
|
-
const configuration = options?.configuration ?? getConfiguration();
|
|
89
|
-
const appLogger = getAppLogger(configuration);
|
|
90
|
-
const { watch: isWatchMode, watchedFilesPatternWithPath } = configuration.content;
|
|
91
|
-
return chokidarWatch(watchedFilesPatternWithPath, {
|
|
92
|
-
persistent: isWatchMode,
|
|
93
|
-
// Make the watcher persistent
|
|
94
|
-
ignoreInitial: true,
|
|
95
|
-
// Process existing files
|
|
96
|
-
...options
|
|
97
|
-
}).on("add", async (filePath) => {
|
|
98
|
-
const fileName = basename(filePath);
|
|
99
|
-
recentlyAddedFiles.add(fileName);
|
|
100
|
-
await handleAdditionalContentDeclarationFile(filePath, configuration);
|
|
101
|
-
setTimeout(() => recentlyAddedFiles.delete(fileName), 1e3);
|
|
102
|
-
}).on(
|
|
103
|
-
"change",
|
|
104
|
-
async (filePath) => await handleContentDeclarationFileChange(filePath, configuration)
|
|
105
|
-
).on("unlink", async (filePath) => {
|
|
106
|
-
setTimeout(async () => {
|
|
107
|
-
const fileName = basename(filePath);
|
|
108
|
-
if (recentlyAddedFiles.has(fileName)) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
await handleUnlikedContentDeclarationFile(filePath, configuration);
|
|
112
|
-
}, 300);
|
|
113
|
-
}).on("error", async (error) => {
|
|
114
|
-
appLogger("Watcher error: " + error, {
|
|
115
|
-
level: "error"
|
|
116
|
-
});
|
|
117
|
-
appLogger("Restarting watcher");
|
|
118
|
-
await prepareIntlayer(configuration);
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
const buildAndWatchIntlayer = async (options) => {
|
|
122
|
-
const configuration = options?.configuration ?? getConfiguration(options?.configOptions);
|
|
123
|
-
await prepareIntlayer(configuration);
|
|
124
|
-
if (configuration.content.watch || options.persistent) {
|
|
125
|
-
watch({ ...options, configuration });
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
export {
|
|
129
|
-
buildAndWatchIntlayer,
|
|
130
|
-
handleAdditionalContentDeclarationFile,
|
|
131
|
-
handleContentDeclarationFileChange,
|
|
132
|
-
handleUnlikedContentDeclarationFile,
|
|
133
|
-
watch
|
|
134
|
-
};
|
|
135
|
-
//# sourceMappingURL=watcher.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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 } 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 { createDictionaryEntryPoint } from '../transpiler/dictionary_to_main/createDictionaryEntryPoint';\nimport {\n createModuleAugmentation,\n createTypes,\n} from '../transpiler/dictionary_to_type/index';\nimport { buildDictionary } from '../transpiler/intlayer_dictionary/buildIntlayerDictionary';\nimport { formatPath } from '../utils/formatter';\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\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await 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\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(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, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await createDictionaryEntryPoint();\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await 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\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n const allDictionariesPaths: string[] = 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 await 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":"AAAA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AAEzB,SAA+B,SAAS,qBAAqB;AAC7D,SAAS,gCAAgC;AACzC,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AACtC,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,kBAAkB;AAE3B,MAAM,qBAAqB,oBAAI,IAAY;AAEpC,MAAM,yCAAyC,OACpD,UACA,kBACG;AACH,QAAM,SAAS,iBAAiB,iBAAiB;AACjD,QAAM,YAAY,aAAa,MAAM;AAGrC,YAAU,6BAA6B,WAAW,QAAQ,CAAC,IAAI;AAAA,IAC7D,WAAW;AAAA,EACb,CAAC;AAED,QAAM,qBAAqB,MAAM,sBAAsB,QAAQ;AAE/D,QAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,MAAM;AAE3E,QAAM,oBAAoB,OAAO;AAAA,IAC/B,oBAAoB,sBAAsB,CAAC;AAAA,EAC7C,EAAE,IAAI,CAAC,eAAe,WAAW,cAAc;AAE/C,QAAM,YAAY,iBAAiB;AAEnC,QAAM,2BAA2B;AAEjC,YAAU,sBAAsB;AAAA,IAC9B,WAAW;AAAA,EACb,CAAC;AAED,2BAAyB;AAEzB,YAAU,6BAA6B;AAAA,IACrC,WAAW;AAAA,EACb,CAAC;AACH;AAEO,MAAM,sCAAsC,OACjD,UACA,kBACG;AACH,QAAM,SAAS,iBAAiB,iBAAiB;AACjD,QAAM,YAAY,aAAa,MAAM;AAGrC,YAAU,sBAAsB,WAAW,QAAQ,CAAC,IAAI;AAAA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a;AAE5C,QAAM,EAAE,OAAO,aAAa,4BAA4B,IACtD,cAAc;AAGhB,SAAO,cAAc,6BAA6B;AAAA,IAChD,YAAY;AAAA;AAAA,IACZ,eAAe;AAAA;AAAA,IACf,GAAG;AAAA,EACL,CAAC,EACE,GAAG,OAAO,OAAO,aAAa;AAC7B,UAAM,WAAW,SAAS,QAAQ;AAClC,uBAAmB,IAAI,QAAQ;AAE/B,UAAM,uCAAuC,UAAU,aAAa;AAEpE,eAAW,MAAM,mBAAmB,OAAO,QAAQ,GAAG,GAAI;AAAA,EAC5D,CAAC,EACA;AAAA,IACC;AAAA,IACA,OAAO,aACL,MAAM,mCAAmC,UAAU,aAAa;AAAA,EACpE,EACC,GAAG,UAAU,OAAO,aAAa;AAChC,eAAW,YAAY;AACrB,YAAM,WAAW,SAAS,QAAQ;AAElC,UAAI,mBAAmB,IAAI,QAAQ,GAAG;AAEpC;AAAA,MACF;AAEA,YAAM,oCAAoC,UAAU,aAAa;AAAA,IACnE,GAAG,GAAG;AAAA,EACR,CAAC,EACA,GAAG,SAAS,OAAO,UAAU;AAC5B,cAAU,oBAAoB,OAAO;AAAA,MACnC,OAAO;AAAA,IACT,CAAC;AAED,cAAU,oBAAoB;AAE9B,UAAM,gBAAgB,aAAa;AAAA,EACrC,CAAC;AACL;AAEO,MAAM,wBAAwB,OAAO,YAA2B;AACrE,QAAM,gBACJ,SAAS,iBAAiB,iBAAiB,SAAS,aAAa;AAEnE,QAAM,gBAAgB,aAAa;AAEnC,MAAI,cAAc,QAAQ,SAAS,QAAQ,YAAY;AAErD,UAAM,EAAE,GAAG,SAAS,cAAc,CAAC;AAAA,EACrC;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getBuiltDictionariesPath.ts"],"sourcesContent":["import { getConfiguration, normalizePath } 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 getBuiltDictionariesPath = (\n configuration = getConfiguration()\n) => {\n const { dictionariesDir, mainDir } = configuration.content;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n mkdirSync(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(dictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath;\n};\n"],"mappings":"AAAA,SAAS,kBAAkB,qBAAqB;AAChD,OAAO,QAAQ;AACf,SAAS,YAAY,iBAAiB;AAK/B,MAAM,2BAA2B,CACtC,gBAAgB,iBAAiB,MAC9B;AACH,QAAM,EAAE,iBAAiB,QAAQ,IAAI,cAAc;AAGnD,MAAI,CAAC,WAAW,OAAO,GAAG;AACxB,cAAU,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACxC;AAEA,QAAM,mBAA6B,GAAG;AAAA,IACpC,GAAG,cAAc,eAAe,CAAC;AAAA,EACnC;AAEA,SAAO;AACT;","names":[]}
|