@intlayer/chokidar 6.0.2 → 6.1.1
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 +24 -29
- 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
|
@@ -0,0 +1,770 @@
|
|
|
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 transformJSFile_exports = {};
|
|
20
|
+
__export(transformJSFile_exports, {
|
|
21
|
+
transformJSFile: () => transformJSFile
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(transformJSFile_exports);
|
|
24
|
+
var import_core = require("@intlayer/core");
|
|
25
|
+
var import_ts_morph = require("ts-morph");
|
|
26
|
+
const isTranslationNode = (value) => {
|
|
27
|
+
if (!value || typeof value !== "object") return false;
|
|
28
|
+
const v = value;
|
|
29
|
+
const hasNodeTypeTranslation = v.nodeType === import_core.NodeType.Translation;
|
|
30
|
+
const hasTranslationObject = v[import_core.NodeType.Translation] && typeof v[import_core.NodeType.Translation] === "object";
|
|
31
|
+
return Boolean(hasTranslationObject || hasNodeTypeTranslation);
|
|
32
|
+
};
|
|
33
|
+
const isEnumerationNode = (value) => {
|
|
34
|
+
if (!value || typeof value !== "object") return false;
|
|
35
|
+
const v = value;
|
|
36
|
+
return v.nodeType === import_core.NodeType.Enumeration || v[import_core.NodeType.Enumeration] && typeof v[import_core.NodeType.Enumeration] === "object";
|
|
37
|
+
};
|
|
38
|
+
const isConditionNode = (value) => {
|
|
39
|
+
if (!value || typeof value !== "object") return false;
|
|
40
|
+
const v = value;
|
|
41
|
+
return v.nodeType === import_core.NodeType.Condition || v[import_core.NodeType.Condition] && typeof v[import_core.NodeType.Condition] === "object";
|
|
42
|
+
};
|
|
43
|
+
const isGenderNode = (value) => {
|
|
44
|
+
if (!value || typeof value !== "object") return false;
|
|
45
|
+
const v = value;
|
|
46
|
+
return v.nodeType === import_core.NodeType.Gender || v[import_core.NodeType.Gender] && typeof v[import_core.NodeType.Gender] === "object";
|
|
47
|
+
};
|
|
48
|
+
const isInsertionNode = (value) => {
|
|
49
|
+
if (!value || typeof value !== "object") return false;
|
|
50
|
+
const v = value;
|
|
51
|
+
return v.nodeType === import_core.NodeType.Insertion || import_core.NodeType.Insertion in v;
|
|
52
|
+
};
|
|
53
|
+
const isMarkdownNode = (value) => {
|
|
54
|
+
if (!value || typeof value !== "object") return false;
|
|
55
|
+
const v = value;
|
|
56
|
+
return v.nodeType === import_core.NodeType.Markdown || import_core.NodeType.Markdown in v;
|
|
57
|
+
};
|
|
58
|
+
const isFileNode = (value) => {
|
|
59
|
+
if (!value || typeof value !== "object") return false;
|
|
60
|
+
const v = value;
|
|
61
|
+
return v.nodeType === import_core.NodeType.File || typeof v[import_core.NodeType.File] === "string";
|
|
62
|
+
};
|
|
63
|
+
const isNestedNode = (value) => {
|
|
64
|
+
if (!value || typeof value !== "object") return false;
|
|
65
|
+
const v = value;
|
|
66
|
+
return v.nodeType === import_core.NodeType.Nested || import_core.NodeType.Nested in v;
|
|
67
|
+
};
|
|
68
|
+
const buildTranslationInitializer = (translationMap) => {
|
|
69
|
+
const entries = Object.entries(translationMap).sort(([a], [b]) => a.localeCompare(b));
|
|
70
|
+
const parts = [];
|
|
71
|
+
for (const [lang, val] of entries) {
|
|
72
|
+
const isValidIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(lang);
|
|
73
|
+
const keyText = isValidIdentifier ? lang : JSON.stringify(lang);
|
|
74
|
+
if (typeof val === "string") {
|
|
75
|
+
parts.push(`${keyText}: ${JSON.stringify(val)}`);
|
|
76
|
+
} else {
|
|
77
|
+
parts.push(`${keyText}: ${JSON.stringify(val)}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return `t({ ${parts.join(", ")} })`;
|
|
81
|
+
};
|
|
82
|
+
const stringifyKey = (key) => {
|
|
83
|
+
const isValidIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key);
|
|
84
|
+
if (!isValidIdentifier) return JSON.stringify(key);
|
|
85
|
+
if (key === "true" || key === "false") return JSON.stringify(key);
|
|
86
|
+
return key;
|
|
87
|
+
};
|
|
88
|
+
const buildEnumerationInitializer = (map) => {
|
|
89
|
+
const parts = [];
|
|
90
|
+
for (const [k, v] of Object.entries(map)) {
|
|
91
|
+
if (typeof v !== "string") return "";
|
|
92
|
+
parts.push(`${stringifyKey(k)}: ${JSON.stringify(v)}`);
|
|
93
|
+
}
|
|
94
|
+
return `enu({ ${parts.join(", ")} })`;
|
|
95
|
+
};
|
|
96
|
+
const buildConditionInitializer = (map) => {
|
|
97
|
+
const parts = [];
|
|
98
|
+
for (const [k, v] of Object.entries(map)) {
|
|
99
|
+
if (typeof v !== "string") return "";
|
|
100
|
+
parts.push(`${stringifyKey(k)}: ${JSON.stringify(v)}`);
|
|
101
|
+
}
|
|
102
|
+
return `cond({ ${parts.join(", ")} })`;
|
|
103
|
+
};
|
|
104
|
+
const buildGenderInitializer = (map) => {
|
|
105
|
+
const parts = [];
|
|
106
|
+
for (const [k, v] of Object.entries(map)) {
|
|
107
|
+
if (typeof v !== "string") return "";
|
|
108
|
+
parts.push(`${stringifyKey(k)}: ${JSON.stringify(v)}`);
|
|
109
|
+
}
|
|
110
|
+
return `gender({ ${parts.join(", ")} })`;
|
|
111
|
+
};
|
|
112
|
+
const buildInsertionInitializer = (content) => {
|
|
113
|
+
if (typeof content === "string") return `insert(${JSON.stringify(content)})`;
|
|
114
|
+
if (isTranslationNode(content)) {
|
|
115
|
+
const translations = content.translation ?? content["translation"] ?? {};
|
|
116
|
+
const allStrings = Object.values(translations).every(
|
|
117
|
+
(v) => typeof v === "string"
|
|
118
|
+
);
|
|
119
|
+
if (!allStrings) return void 0;
|
|
120
|
+
return `insert(${buildTranslationInitializer(
|
|
121
|
+
translations
|
|
122
|
+
)})`;
|
|
123
|
+
}
|
|
124
|
+
return void 0;
|
|
125
|
+
};
|
|
126
|
+
const buildFileInitializer = (path) => {
|
|
127
|
+
if (typeof path === "string") return `file(${JSON.stringify(path)})`;
|
|
128
|
+
return void 0;
|
|
129
|
+
};
|
|
130
|
+
const buildMarkdownInitializer = (content) => {
|
|
131
|
+
if (typeof content === "string") return `md(${JSON.stringify(content)})`;
|
|
132
|
+
if (isFileNode(content)) {
|
|
133
|
+
const p = content[import_core.NodeType.File];
|
|
134
|
+
const fileInit = buildFileInitializer(p);
|
|
135
|
+
if (!fileInit) return void 0;
|
|
136
|
+
return `md(${fileInit})`;
|
|
137
|
+
}
|
|
138
|
+
return void 0;
|
|
139
|
+
};
|
|
140
|
+
const buildNestedInitializer = (obj) => {
|
|
141
|
+
const data = obj?.[import_core.NodeType.Nested];
|
|
142
|
+
if (!data || typeof data.dictionaryKey !== "string") return void 0;
|
|
143
|
+
if (data.path && typeof data.path === "string") {
|
|
144
|
+
return `nest(${JSON.stringify(data.dictionaryKey)}, ${JSON.stringify(data.path)})`;
|
|
145
|
+
}
|
|
146
|
+
return `nest(${JSON.stringify(data.dictionaryKey)})`;
|
|
147
|
+
};
|
|
148
|
+
const readExistingTranslationMap = (contentObject, propName) => {
|
|
149
|
+
const prop = contentObject.getProperty(propName);
|
|
150
|
+
if (!prop || !import_ts_morph.Node.isPropertyAssignment(prop)) return void 0;
|
|
151
|
+
const init = prop.getInitializer();
|
|
152
|
+
if (!init) return void 0;
|
|
153
|
+
if (!import_ts_morph.Node.isCallExpression(init)) return void 0;
|
|
154
|
+
const exp = init.getExpression();
|
|
155
|
+
if (!import_ts_morph.Node.isIdentifier(exp) || exp.getText() !== "t") return void 0;
|
|
156
|
+
const arg = init.getArguments()[0];
|
|
157
|
+
if (!arg || !import_ts_morph.Node.isObjectLiteralExpression(arg)) return void 0;
|
|
158
|
+
const map = {};
|
|
159
|
+
for (const p of arg.getProperties()) {
|
|
160
|
+
if (!import_ts_morph.Node.isPropertyAssignment(p)) continue;
|
|
161
|
+
const nameNode = p.getNameNode();
|
|
162
|
+
const rawName = nameNode.getText();
|
|
163
|
+
const name = rawName.replace(/^['"]|['"]$/g, "");
|
|
164
|
+
const valueInit = p.getInitializer();
|
|
165
|
+
if (valueInit && import_ts_morph.Node.isStringLiteral(valueInit)) {
|
|
166
|
+
map[name] = valueInit.getLiteralValue();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return map;
|
|
170
|
+
};
|
|
171
|
+
const readExistingMapFromCall = (contentObject, propName, callee) => {
|
|
172
|
+
const prop = contentObject.getProperty(propName);
|
|
173
|
+
if (!prop || !import_ts_morph.Node.isPropertyAssignment(prop)) return void 0;
|
|
174
|
+
const init = prop.getInitializer();
|
|
175
|
+
if (!init || !import_ts_morph.Node.isCallExpression(init)) return void 0;
|
|
176
|
+
const exp = init.getExpression();
|
|
177
|
+
if (!import_ts_morph.Node.isIdentifier(exp) || exp.getText() !== callee) return void 0;
|
|
178
|
+
const arg = init.getArguments()[0];
|
|
179
|
+
if (!arg || !import_ts_morph.Node.isObjectLiteralExpression(arg)) return void 0;
|
|
180
|
+
const map = {};
|
|
181
|
+
for (const p of arg.getProperties()) {
|
|
182
|
+
if (!import_ts_morph.Node.isPropertyAssignment(p)) continue;
|
|
183
|
+
const nameNode = p.getNameNode();
|
|
184
|
+
const rawName = nameNode.getText();
|
|
185
|
+
const name = rawName.replace(/^['"]|['"]$/g, "");
|
|
186
|
+
const valueInit = p.getInitializer();
|
|
187
|
+
if (valueInit && import_ts_morph.Node.isStringLiteral(valueInit)) {
|
|
188
|
+
map[name] = valueInit.getLiteralValue();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return map;
|
|
192
|
+
};
|
|
193
|
+
const areStringMapsEqual = (a, b) => {
|
|
194
|
+
if (!b) return false;
|
|
195
|
+
const aEntries = Object.entries(a).filter(
|
|
196
|
+
([, v]) => typeof v === "string"
|
|
197
|
+
);
|
|
198
|
+
if (aEntries.length !== Object.keys(a).length) return false;
|
|
199
|
+
if (aEntries.length !== Object.keys(b).length) return false;
|
|
200
|
+
for (const [k, v] of aEntries) {
|
|
201
|
+
if (!(k in b)) return false;
|
|
202
|
+
if (b[k] !== v) return false;
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
205
|
+
};
|
|
206
|
+
const readExistingInsertion = (contentObject, propName) => {
|
|
207
|
+
const prop = contentObject.getProperty(propName);
|
|
208
|
+
if (!prop || !import_ts_morph.Node.isPropertyAssignment(prop)) return void 0;
|
|
209
|
+
const init = prop.getInitializer();
|
|
210
|
+
if (!init || !import_ts_morph.Node.isCallExpression(init)) return void 0;
|
|
211
|
+
const exp = init.getExpression();
|
|
212
|
+
if (!import_ts_morph.Node.isIdentifier(exp) || exp.getText() !== "insert") return void 0;
|
|
213
|
+
const arg = init.getArguments()[0];
|
|
214
|
+
if (!arg) return void 0;
|
|
215
|
+
if (import_ts_morph.Node.isStringLiteral(arg)) {
|
|
216
|
+
return { kind: "string", value: arg.getLiteralValue() };
|
|
217
|
+
}
|
|
218
|
+
if (import_ts_morph.Node.isCallExpression(arg)) {
|
|
219
|
+
const aexp = arg.getExpression();
|
|
220
|
+
if (import_ts_morph.Node.isIdentifier(aexp) && aexp.getText() === "t") {
|
|
221
|
+
const tArg = arg.getArguments()[0];
|
|
222
|
+
if (tArg && import_ts_morph.Node.isObjectLiteralExpression(tArg)) {
|
|
223
|
+
const map = {};
|
|
224
|
+
for (const p of tArg.getProperties()) {
|
|
225
|
+
if (!import_ts_morph.Node.isPropertyAssignment(p)) continue;
|
|
226
|
+
const nameNode = p.getNameNode();
|
|
227
|
+
const rawName = nameNode.getText();
|
|
228
|
+
const name = rawName.replace(/^['"]|['"]$/g, "");
|
|
229
|
+
const valueInit = p.getInitializer();
|
|
230
|
+
if (valueInit && import_ts_morph.Node.isStringLiteral(valueInit)) {
|
|
231
|
+
map[name] = valueInit.getLiteralValue();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return { kind: "translation", map };
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return void 0;
|
|
239
|
+
};
|
|
240
|
+
const readExistingMarkdown = (contentObject, propName) => {
|
|
241
|
+
const prop = contentObject.getProperty(propName);
|
|
242
|
+
if (!prop || !import_ts_morph.Node.isPropertyAssignment(prop)) return void 0;
|
|
243
|
+
const init = prop.getInitializer();
|
|
244
|
+
if (!init || !import_ts_morph.Node.isCallExpression(init)) return void 0;
|
|
245
|
+
const exp = init.getExpression();
|
|
246
|
+
if (!import_ts_morph.Node.isIdentifier(exp) || exp.getText() !== "md") return void 0;
|
|
247
|
+
const arg = init.getArguments()[0];
|
|
248
|
+
if (!arg) return void 0;
|
|
249
|
+
if (import_ts_morph.Node.isStringLiteral(arg)) {
|
|
250
|
+
return { kind: "string", value: arg.getLiteralValue() };
|
|
251
|
+
}
|
|
252
|
+
if (import_ts_morph.Node.isCallExpression(arg)) {
|
|
253
|
+
const aexp = arg.getExpression();
|
|
254
|
+
if (import_ts_morph.Node.isIdentifier(aexp) && aexp.getText() === "file") {
|
|
255
|
+
const fArg = arg.getArguments()[0];
|
|
256
|
+
if (fArg && import_ts_morph.Node.isStringLiteral(fArg)) {
|
|
257
|
+
return { kind: "file", path: fArg.getLiteralValue() };
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return void 0;
|
|
262
|
+
};
|
|
263
|
+
const readExistingFilePath = (contentObject, propName) => {
|
|
264
|
+
const prop = contentObject.getProperty(propName);
|
|
265
|
+
if (!prop || !import_ts_morph.Node.isPropertyAssignment(prop)) return void 0;
|
|
266
|
+
const init = prop.getInitializer();
|
|
267
|
+
if (!init || !import_ts_morph.Node.isCallExpression(init)) return void 0;
|
|
268
|
+
const exp = init.getExpression();
|
|
269
|
+
if (!import_ts_morph.Node.isIdentifier(exp) || exp.getText() !== "file") return void 0;
|
|
270
|
+
const arg = init.getArguments()[0];
|
|
271
|
+
if (arg && import_ts_morph.Node.isStringLiteral(arg)) return arg.getLiteralValue();
|
|
272
|
+
return void 0;
|
|
273
|
+
};
|
|
274
|
+
const readExistingNest = (contentObject, propName) => {
|
|
275
|
+
const prop = contentObject.getProperty(propName);
|
|
276
|
+
if (!prop || !import_ts_morph.Node.isPropertyAssignment(prop)) return void 0;
|
|
277
|
+
let init = prop.getInitializer();
|
|
278
|
+
if (!init) return void 0;
|
|
279
|
+
let safetyCounter = 0;
|
|
280
|
+
while (safetyCounter++ < 5) {
|
|
281
|
+
if (import_ts_morph.Node.isCallExpression(init)) break;
|
|
282
|
+
const anyInit = init;
|
|
283
|
+
const nextExpr = anyInit.getExpression?.();
|
|
284
|
+
if (nextExpr && typeof nextExpr === "object" && nextExpr !== init) {
|
|
285
|
+
init = nextExpr;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
if (!import_ts_morph.Node.isCallExpression(init)) return void 0;
|
|
291
|
+
const exp = init.getExpression();
|
|
292
|
+
if (!import_ts_morph.Node.isIdentifier(exp) || exp.getText() !== "nest") return void 0;
|
|
293
|
+
const [arg1, arg2] = init.getArguments();
|
|
294
|
+
if (!arg1 || !import_ts_morph.Node.isStringLiteral(arg1)) return void 0;
|
|
295
|
+
const dictionaryKey = arg1.getLiteralValue();
|
|
296
|
+
let path;
|
|
297
|
+
if (arg2 && import_ts_morph.Node.isStringLiteral(arg2)) path = arg2.getLiteralValue();
|
|
298
|
+
return { dictionaryKey, path };
|
|
299
|
+
};
|
|
300
|
+
const unwrapToObjectLiteral = (node) => {
|
|
301
|
+
if (!node || typeof node !== "object") return void 0;
|
|
302
|
+
let current = node;
|
|
303
|
+
let safetyCounter = 0;
|
|
304
|
+
while (safetyCounter++ < 8) {
|
|
305
|
+
if (import_ts_morph.Node.isObjectLiteralExpression(current)) return current;
|
|
306
|
+
const next = current?.getExpression?.();
|
|
307
|
+
if (next && typeof next === "object" && next !== current) {
|
|
308
|
+
current = next;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
return void 0;
|
|
314
|
+
};
|
|
315
|
+
const readExistingArraySerialized = (contentObject, propName) => {
|
|
316
|
+
const prop = contentObject.getProperty(propName);
|
|
317
|
+
if (!prop || !import_ts_morph.Node.isPropertyAssignment(prop)) return void 0;
|
|
318
|
+
const init = prop.getInitializer();
|
|
319
|
+
if (!init || !import_ts_morph.Node.isArrayLiteralExpression(init)) return void 0;
|
|
320
|
+
const serialized = [];
|
|
321
|
+
for (const el of init.getElements()) {
|
|
322
|
+
if (import_ts_morph.Node.isStringLiteral(el)) {
|
|
323
|
+
serialized.push(JSON.stringify(el.getLiteralValue()));
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
if (import_ts_morph.Node.isNumericLiteral(el)) {
|
|
327
|
+
serialized.push(el.getText());
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
if (el.getKind() === import_ts_morph.SyntaxKind.TrueKeyword || el.getKind() === import_ts_morph.SyntaxKind.FalseKeyword) {
|
|
331
|
+
serialized.push(el.getText());
|
|
332
|
+
continue;
|
|
333
|
+
}
|
|
334
|
+
if (import_ts_morph.Node.isNullLiteral(el)) {
|
|
335
|
+
serialized.push("null");
|
|
336
|
+
continue;
|
|
337
|
+
}
|
|
338
|
+
if (import_ts_morph.Node.isCallExpression(el)) {
|
|
339
|
+
const exp = el.getExpression();
|
|
340
|
+
if (import_ts_morph.Node.isIdentifier(exp) && exp.getText() === "t") {
|
|
341
|
+
const arg = el.getArguments()[0];
|
|
342
|
+
if (arg && import_ts_morph.Node.isObjectLiteralExpression(arg)) {
|
|
343
|
+
const map = {};
|
|
344
|
+
for (const p of arg.getProperties()) {
|
|
345
|
+
if (!import_ts_morph.Node.isPropertyAssignment(p)) return void 0;
|
|
346
|
+
const nameNode = p.getNameNode();
|
|
347
|
+
const rawName = nameNode.getText();
|
|
348
|
+
const name = rawName.replace(/^['"]|['"]$/g, "");
|
|
349
|
+
const valueInit = p.getInitializer();
|
|
350
|
+
if (valueInit && import_ts_morph.Node.isStringLiteral(valueInit)) {
|
|
351
|
+
map[name] = valueInit.getLiteralValue();
|
|
352
|
+
} else {
|
|
353
|
+
return void 0;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
serialized.push(buildTranslationInitializer(map));
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
return void 0;
|
|
362
|
+
}
|
|
363
|
+
return serialized;
|
|
364
|
+
};
|
|
365
|
+
const serializeValue = (value) => {
|
|
366
|
+
if (typeof value === "string") return JSON.stringify(value);
|
|
367
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
368
|
+
return String(value);
|
|
369
|
+
if (value === null) return "null";
|
|
370
|
+
if (isTranslationNode(value)) {
|
|
371
|
+
const translations = value.translation ?? value["translation"] ?? {};
|
|
372
|
+
const allStrings = Object.values(translations).every(
|
|
373
|
+
(v) => typeof v === "string"
|
|
374
|
+
);
|
|
375
|
+
if (!allStrings) return void 0;
|
|
376
|
+
return buildTranslationInitializer(translations);
|
|
377
|
+
}
|
|
378
|
+
if (isEnumerationNode(value)) {
|
|
379
|
+
const map = value[import_core.NodeType.Enumeration];
|
|
380
|
+
const init = buildEnumerationInitializer(map);
|
|
381
|
+
return init || void 0;
|
|
382
|
+
}
|
|
383
|
+
if (isConditionNode(value)) {
|
|
384
|
+
const map = value[import_core.NodeType.Condition];
|
|
385
|
+
const init = buildConditionInitializer(map);
|
|
386
|
+
return init || void 0;
|
|
387
|
+
}
|
|
388
|
+
if (isGenderNode(value)) {
|
|
389
|
+
const map = value[import_core.NodeType.Gender];
|
|
390
|
+
const init = buildGenderInitializer(map);
|
|
391
|
+
return init || void 0;
|
|
392
|
+
}
|
|
393
|
+
if (isInsertionNode(value)) {
|
|
394
|
+
const content = value[import_core.NodeType.Insertion];
|
|
395
|
+
return buildInsertionInitializer(content);
|
|
396
|
+
}
|
|
397
|
+
if (isMarkdownNode(value)) {
|
|
398
|
+
const content = value[import_core.NodeType.Markdown];
|
|
399
|
+
return buildMarkdownInitializer(content);
|
|
400
|
+
}
|
|
401
|
+
if (isFileNode(value)) {
|
|
402
|
+
const path = value[import_core.NodeType.File];
|
|
403
|
+
return buildFileInitializer(path);
|
|
404
|
+
}
|
|
405
|
+
if (isNestedNode(value)) {
|
|
406
|
+
return buildNestedInitializer(value);
|
|
407
|
+
}
|
|
408
|
+
return void 0;
|
|
409
|
+
};
|
|
410
|
+
const transformJSFile = async (fileContent, dictionary) => {
|
|
411
|
+
try {
|
|
412
|
+
if (!dictionary || typeof dictionary !== "object" || !dictionary.content) {
|
|
413
|
+
return fileContent;
|
|
414
|
+
}
|
|
415
|
+
const project = new import_ts_morph.Project({
|
|
416
|
+
useInMemoryFileSystem: true,
|
|
417
|
+
skipAddingFilesFromTsConfig: true,
|
|
418
|
+
skipFileDependencyResolution: true,
|
|
419
|
+
compilerOptions: {
|
|
420
|
+
allowJs: true,
|
|
421
|
+
jsx: import_ts_morph.ts.JsxEmit.Preserve
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
const sourceFile = project.createSourceFile("file.tsx", fileContent, {
|
|
425
|
+
overwrite: true
|
|
426
|
+
});
|
|
427
|
+
let rootObject;
|
|
428
|
+
const exportAssignment = sourceFile.getExportAssignment((_) => true);
|
|
429
|
+
if (exportAssignment) {
|
|
430
|
+
const expr = exportAssignment.getExpression();
|
|
431
|
+
if (import_ts_morph.Node.isIdentifier(expr)) {
|
|
432
|
+
const declFromSymbol = expr.getSymbol()?.getDeclarations()?.[0];
|
|
433
|
+
const declByName = declFromSymbol ?? sourceFile.getVariableDeclaration(expr.getText());
|
|
434
|
+
if (declByName && import_ts_morph.Node.isVariableDeclaration(declByName)) {
|
|
435
|
+
const initAny = declByName.getInitializer();
|
|
436
|
+
const obj = unwrapToObjectLiteral(initAny);
|
|
437
|
+
if (obj) rootObject = obj;
|
|
438
|
+
}
|
|
439
|
+
} else if (import_ts_morph.Node.isObjectLiteralExpression(expr)) {
|
|
440
|
+
rootObject = expr;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
if (!rootObject) {
|
|
444
|
+
const varDecl = sourceFile.getVariableDeclaration((v) => {
|
|
445
|
+
try {
|
|
446
|
+
const typeText = v.getType().getText();
|
|
447
|
+
return typeText.includes("Dictionary") || v.getName() === "content" || v.getName().toLowerCase().includes("dictionary");
|
|
448
|
+
} catch {
|
|
449
|
+
return v.getName() === "content";
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
if (varDecl) {
|
|
453
|
+
const obj = unwrapToObjectLiteral(varDecl.getInitializer());
|
|
454
|
+
if (obj) rootObject = obj;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (!rootObject) {
|
|
458
|
+
for (const stmt of sourceFile.getStatements()) {
|
|
459
|
+
if (!import_ts_morph.Node.isExpressionStatement(stmt)) continue;
|
|
460
|
+
const expr = stmt.getExpression();
|
|
461
|
+
if (!import_ts_morph.Node.isBinaryExpression(expr)) continue;
|
|
462
|
+
const operator = expr.getOperatorToken();
|
|
463
|
+
if (operator.getText() !== "=") continue;
|
|
464
|
+
const left = expr.getLeft();
|
|
465
|
+
if (!import_ts_morph.Node.isPropertyAccessExpression(left)) continue;
|
|
466
|
+
const leftExpr = left.getExpression();
|
|
467
|
+
const leftName = left.getName();
|
|
468
|
+
const isModuleExports = import_ts_morph.Node.isIdentifier(leftExpr) && leftExpr.getText() === "module" && leftName === "exports";
|
|
469
|
+
const isExportsDefault = import_ts_morph.Node.isIdentifier(leftExpr) && leftExpr.getText() === "exports" && leftName === "default";
|
|
470
|
+
if (!isModuleExports && !isExportsDefault) continue;
|
|
471
|
+
const right = expr.getRight();
|
|
472
|
+
if (import_ts_morph.Node.isObjectLiteralExpression(right)) {
|
|
473
|
+
rootObject = right;
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
if (import_ts_morph.Node.isIdentifier(right)) {
|
|
477
|
+
const decl = right.getSymbol()?.getDeclarations()?.[0];
|
|
478
|
+
if (decl && import_ts_morph.Node.isVariableDeclaration(decl)) {
|
|
479
|
+
const obj = unwrapToObjectLiteral(decl.getInitializer());
|
|
480
|
+
if (obj) {
|
|
481
|
+
rootObject = obj;
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (!rootObject) {
|
|
489
|
+
return fileContent;
|
|
490
|
+
}
|
|
491
|
+
const contentProp = rootObject.getProperty("content");
|
|
492
|
+
let contentObject;
|
|
493
|
+
if (contentProp && import_ts_morph.Node.isPropertyAssignment(contentProp)) {
|
|
494
|
+
contentObject = contentProp.getInitializerIfKind(
|
|
495
|
+
import_ts_morph.SyntaxKind.ObjectLiteralExpression
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
if (!contentObject || !dictionary.content) {
|
|
499
|
+
return fileContent;
|
|
500
|
+
}
|
|
501
|
+
const existingKeys = /* @__PURE__ */ new Set();
|
|
502
|
+
for (const prop of contentObject.getProperties()) {
|
|
503
|
+
if (import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
504
|
+
const name = prop.getName();
|
|
505
|
+
if (name) existingKeys.add(name.replace(/^['"]|['"]$/g, ""));
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
let changed = false;
|
|
509
|
+
const dictContent = dictionary.content || {};
|
|
510
|
+
const areTranslationsEqual = (desired, existing) => {
|
|
511
|
+
if (!existing) return false;
|
|
512
|
+
for (const [lang, val] of Object.entries(desired)) {
|
|
513
|
+
if (typeof val !== "string") return false;
|
|
514
|
+
if (!(lang in existing)) return false;
|
|
515
|
+
if (existing[lang] !== val) return false;
|
|
516
|
+
}
|
|
517
|
+
return true;
|
|
518
|
+
};
|
|
519
|
+
for (const [key, value] of Object.entries(dictContent)) {
|
|
520
|
+
if (Array.isArray(value)) {
|
|
521
|
+
const serializedElements = [];
|
|
522
|
+
let unsupported = false;
|
|
523
|
+
for (const el of value) {
|
|
524
|
+
const s = serializeValue(el);
|
|
525
|
+
if (s === void 0) {
|
|
526
|
+
unsupported = true;
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
529
|
+
serializedElements.push(s);
|
|
530
|
+
}
|
|
531
|
+
if (unsupported) {
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
const initializerText = `[ ${serializedElements.join(", ")} ]`;
|
|
535
|
+
if (!existingKeys.has(key)) {
|
|
536
|
+
contentObject.addPropertyAssignment({
|
|
537
|
+
name: key,
|
|
538
|
+
initializer: initializerText
|
|
539
|
+
});
|
|
540
|
+
changed = true;
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
const prop = contentObject.getProperty(key);
|
|
544
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
545
|
+
const existingSerialized = readExistingArraySerialized(
|
|
546
|
+
contentObject,
|
|
547
|
+
key
|
|
548
|
+
);
|
|
549
|
+
const arraysEqual = existingSerialized !== void 0 && existingSerialized.length === serializedElements.length && existingSerialized.every((v, i) => v === serializedElements[i]);
|
|
550
|
+
if (!arraysEqual) {
|
|
551
|
+
prop.setInitializer(initializerText);
|
|
552
|
+
changed = true;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) {
|
|
558
|
+
if (!existingKeys.has(key)) {
|
|
559
|
+
contentObject.addPropertyAssignment({
|
|
560
|
+
name: key,
|
|
561
|
+
initializer: typeof value === "string" ? JSON.stringify(value) : String(value)
|
|
562
|
+
});
|
|
563
|
+
changed = true;
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
const prop = contentObject.getProperty(key);
|
|
567
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
568
|
+
const init = prop.getInitializer();
|
|
569
|
+
const currentText = init?.getText();
|
|
570
|
+
const desiredText = typeof value === "string" ? JSON.stringify(value) : String(value);
|
|
571
|
+
if (currentText !== desiredText) {
|
|
572
|
+
prop.setInitializer(desiredText);
|
|
573
|
+
changed = true;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
if (isTranslationNode(value)) {
|
|
579
|
+
const translations = value.translation ?? value["translation"] ?? {};
|
|
580
|
+
const allStrings = Object.values(translations).every(
|
|
581
|
+
(v) => typeof v === "string"
|
|
582
|
+
);
|
|
583
|
+
if (!allStrings) {
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
const initializerText = buildTranslationInitializer(
|
|
587
|
+
translations
|
|
588
|
+
);
|
|
589
|
+
if (!existingKeys.has(key)) {
|
|
590
|
+
contentObject.addPropertyAssignment({
|
|
591
|
+
name: key,
|
|
592
|
+
initializer: initializerText
|
|
593
|
+
});
|
|
594
|
+
changed = true;
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
const existingMap = readExistingTranslationMap(contentObject, key);
|
|
598
|
+
if (!areTranslationsEqual(translations, existingMap)) {
|
|
599
|
+
const prop = contentObject.getProperty(key);
|
|
600
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
601
|
+
prop.setInitializer(initializerText);
|
|
602
|
+
changed = true;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
} else if (isEnumerationNode(value)) {
|
|
606
|
+
const map = value[import_core.NodeType.Enumeration];
|
|
607
|
+
if (!Object.values(map).every((v) => typeof v === "string")) continue;
|
|
608
|
+
const initializerText = buildEnumerationInitializer(map);
|
|
609
|
+
if (!initializerText) continue;
|
|
610
|
+
if (!existingKeys.has(key)) {
|
|
611
|
+
contentObject.addPropertyAssignment({
|
|
612
|
+
name: key,
|
|
613
|
+
initializer: initializerText
|
|
614
|
+
});
|
|
615
|
+
changed = true;
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
const existingMap = readExistingMapFromCall(contentObject, key, "enu");
|
|
619
|
+
if (!areStringMapsEqual(map, existingMap)) {
|
|
620
|
+
const prop = contentObject.getProperty(key);
|
|
621
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
622
|
+
prop.setInitializer(initializerText);
|
|
623
|
+
changed = true;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
} else if (isConditionNode(value)) {
|
|
627
|
+
const map = value[import_core.NodeType.Condition];
|
|
628
|
+
if (!Object.values(map).every((v) => typeof v === "string")) continue;
|
|
629
|
+
const initializerText = buildConditionInitializer(map);
|
|
630
|
+
if (!initializerText) continue;
|
|
631
|
+
if (!existingKeys.has(key)) {
|
|
632
|
+
contentObject.addPropertyAssignment({
|
|
633
|
+
name: key,
|
|
634
|
+
initializer: initializerText
|
|
635
|
+
});
|
|
636
|
+
changed = true;
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
const existingMap = readExistingMapFromCall(contentObject, key, "cond");
|
|
640
|
+
if (!areStringMapsEqual(map, existingMap)) {
|
|
641
|
+
const prop = contentObject.getProperty(key);
|
|
642
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
643
|
+
prop.setInitializer(initializerText);
|
|
644
|
+
changed = true;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
} else if (isGenderNode(value)) {
|
|
648
|
+
const map = value[import_core.NodeType.Gender];
|
|
649
|
+
if (!Object.values(map).every((v) => typeof v === "string")) continue;
|
|
650
|
+
const initializerText = buildGenderInitializer(map);
|
|
651
|
+
if (!initializerText) continue;
|
|
652
|
+
if (!existingKeys.has(key)) {
|
|
653
|
+
contentObject.addPropertyAssignment({
|
|
654
|
+
name: key,
|
|
655
|
+
initializer: initializerText
|
|
656
|
+
});
|
|
657
|
+
changed = true;
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
const existingMap = readExistingMapFromCall(
|
|
661
|
+
contentObject,
|
|
662
|
+
key,
|
|
663
|
+
"gender"
|
|
664
|
+
);
|
|
665
|
+
if (!areStringMapsEqual(map, existingMap)) {
|
|
666
|
+
const prop = contentObject.getProperty(key);
|
|
667
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
668
|
+
prop.setInitializer(initializerText);
|
|
669
|
+
changed = true;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
} else if (isInsertionNode(value)) {
|
|
673
|
+
const desired = value[import_core.NodeType.Insertion];
|
|
674
|
+
const initializerText = buildInsertionInitializer(desired);
|
|
675
|
+
if (!initializerText) continue;
|
|
676
|
+
if (!existingKeys.has(key)) {
|
|
677
|
+
contentObject.addPropertyAssignment({
|
|
678
|
+
name: key,
|
|
679
|
+
initializer: initializerText
|
|
680
|
+
});
|
|
681
|
+
changed = true;
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
684
|
+
const existing = readExistingInsertion(contentObject, key);
|
|
685
|
+
const isSame = typeof desired === "string" && existing?.kind === "string" && existing.value === desired || isTranslationNode(desired) && existing?.kind === "translation" && areStringMapsEqual(
|
|
686
|
+
desired[import_core.NodeType.Translation] ?? {},
|
|
687
|
+
existing.map
|
|
688
|
+
);
|
|
689
|
+
if (!isSame) {
|
|
690
|
+
const prop = contentObject.getProperty(key);
|
|
691
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
692
|
+
prop.setInitializer(initializerText);
|
|
693
|
+
changed = true;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
} else if (isMarkdownNode(value)) {
|
|
697
|
+
const desired = value[import_core.NodeType.Markdown];
|
|
698
|
+
const initializerText = buildMarkdownInitializer(desired);
|
|
699
|
+
if (!initializerText) continue;
|
|
700
|
+
if (!existingKeys.has(key)) {
|
|
701
|
+
contentObject.addPropertyAssignment({
|
|
702
|
+
name: key,
|
|
703
|
+
initializer: initializerText
|
|
704
|
+
});
|
|
705
|
+
changed = true;
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
const existing = readExistingMarkdown(contentObject, key);
|
|
709
|
+
const isSame = typeof desired === "string" && existing?.kind === "string" && existing.value === desired || isFileNode(desired) && existing?.kind === "file" && existing.path === desired[import_core.NodeType.File];
|
|
710
|
+
if (!isSame) {
|
|
711
|
+
const prop = contentObject.getProperty(key);
|
|
712
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
713
|
+
prop.setInitializer(initializerText);
|
|
714
|
+
changed = true;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
} else if (isFileNode(value)) {
|
|
718
|
+
const desired = value[import_core.NodeType.File];
|
|
719
|
+
const initializerText = buildFileInitializer(desired);
|
|
720
|
+
if (!initializerText) continue;
|
|
721
|
+
if (!existingKeys.has(key)) {
|
|
722
|
+
contentObject.addPropertyAssignment({
|
|
723
|
+
name: key,
|
|
724
|
+
initializer: initializerText
|
|
725
|
+
});
|
|
726
|
+
changed = true;
|
|
727
|
+
continue;
|
|
728
|
+
}
|
|
729
|
+
const existing = readExistingFilePath(contentObject, key);
|
|
730
|
+
if (existing !== desired) {
|
|
731
|
+
const prop = contentObject.getProperty(key);
|
|
732
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
733
|
+
prop.setInitializer(initializerText);
|
|
734
|
+
changed = true;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
} else if (isNestedNode(value)) {
|
|
738
|
+
const initializerText = buildNestedInitializer(value);
|
|
739
|
+
if (!initializerText) continue;
|
|
740
|
+
if (!existingKeys.has(key)) {
|
|
741
|
+
contentObject.addPropertyAssignment({
|
|
742
|
+
name: key,
|
|
743
|
+
initializer: initializerText
|
|
744
|
+
});
|
|
745
|
+
changed = true;
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
const existing = readExistingNest(contentObject, key);
|
|
749
|
+
const desired = value[import_core.NodeType.Nested];
|
|
750
|
+
const isSame = !!desired && existing?.dictionaryKey === desired.dictionaryKey && existing?.path === desired.path;
|
|
751
|
+
if (!isSame) {
|
|
752
|
+
const prop = contentObject.getProperty(key);
|
|
753
|
+
if (prop && import_ts_morph.Node.isPropertyAssignment(prop)) {
|
|
754
|
+
prop.setInitializer(initializerText);
|
|
755
|
+
changed = true;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
if (!changed) return fileContent;
|
|
761
|
+
return sourceFile.getFullText();
|
|
762
|
+
} catch {
|
|
763
|
+
return fileContent;
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
767
|
+
0 && (module.exports = {
|
|
768
|
+
transformJSFile
|
|
769
|
+
});
|
|
770
|
+
//# sourceMappingURL=transformJSFile.cjs.map
|