@intlayer/chokidar 8.1.2 → 8.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/installSkills/skills/angular.md +3 -0
- package/dist/assets/installSkills/skills/astro.md +3 -0
- package/dist/assets/installSkills/skills/cli.md +7 -4
- package/dist/assets/installSkills/skills/config.md +3 -0
- package/dist/assets/installSkills/skills/content.md +3 -0
- package/dist/assets/installSkills/skills/next_js.md +3 -0
- package/dist/assets/installSkills/skills/preact.md +3 -2
- package/dist/assets/installSkills/skills/react.md +3 -0
- package/dist/assets/installSkills/skills/solid.md +3 -0
- package/dist/assets/installSkills/skills/svelte.md +3 -0
- package/dist/assets/installSkills/skills/usage.md +2 -0
- package/dist/assets/installSkills/skills/vue.md +3 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/cjs/_virtual/_utils_asset.cjs +2 -98
- package/dist/cjs/build.cjs +1 -51
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +1 -53
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/index.cjs +1 -6
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +1 -26
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +4 -78
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +4 -62
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -46
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +1 -50
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +1 -59
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
- package/dist/cjs/cleanOutputDir.cjs +1 -30
- package/dist/cjs/cleanOutputDir.cjs.map +1 -1
- package/dist/cjs/cleanRemovedContentDeclaration.cjs +1 -96
- package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
- package/dist/cjs/cli.cjs +1 -21
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -70
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +7 -41
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +1 -23
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +1 -24
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +1 -24
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +1 -23
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +1 -23
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/index.cjs +1 -16
- package/dist/cjs/createType/createModuleAugmentation.cjs +9 -110
- package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
- package/dist/cjs/createType/createType.cjs +1 -29
- package/dist/cjs/createType/createType.cjs.map +1 -1
- package/dist/cjs/createType/index.cjs +1 -8
- package/dist/cjs/fetchDistantDictionaries.cjs +1 -50
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/filterInvalidDictionaries.cjs +1 -49
- package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
- package/dist/cjs/formatDictionary.cjs +1 -49
- package/dist/cjs/formatDictionary.cjs.map +1 -1
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +1 -39
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +1 -34
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
- package/dist/cjs/handleContentDeclarationFileChange.cjs +1 -49
- package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
- package/dist/cjs/handleContentDeclarationFileMoved.cjs +1 -24
- package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +1 -37
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -131
- package/dist/cjs/init/index.cjs +1 -242
- package/dist/cjs/init/index.cjs.map +1 -1
- package/dist/cjs/init/utils/configManipulation.cjs +1 -164
- package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
- package/dist/cjs/init/utils/fileSystem.cjs +1 -30
- package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
- package/dist/cjs/init/utils/index.cjs +1 -13
- package/dist/cjs/init/utils/jsonParser.cjs +3 -42
- package/dist/cjs/init/utils/jsonParser.cjs.map +1 -1
- package/dist/cjs/init/utils/tsConfig.cjs +1 -18
- package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
- package/dist/cjs/initConfig/index.cjs +1 -38
- package/dist/cjs/initConfig/index.cjs.map +1 -1
- package/dist/cjs/installSkills/index.cjs +1 -172
- package/dist/cjs/installSkills/index.cjs.map +1 -1
- package/dist/cjs/listDictionariesPath.cjs +1 -41
- package/dist/cjs/listDictionariesPath.cjs.map +1 -1
- package/dist/cjs/listGitFiles.cjs +5 -95
- package/dist/cjs/listGitFiles.cjs.map +1 -1
- package/dist/cjs/listProjects.cjs +1 -47
- package/dist/cjs/listProjects.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -66
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/index.cjs +1 -12
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +2 -72
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -125
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +1 -28
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +1 -61
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/log.cjs +3 -135
- package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +1 -95
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/reduceDictionaryContent/applyMask.cjs +1 -30
- package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +1 -12
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
- package/dist/cjs/transformFiles/extractDictionaryKey.cjs +1 -16
- package/dist/cjs/transformFiles/extractDictionaryKey.cjs.map +1 -1
- package/dist/cjs/transformFiles/index.cjs +1 -10
- package/dist/cjs/transformFiles/transformFiles.cjs +1 -251
- package/dist/cjs/transformFiles/transformFiles.cjs.map +1 -1
- package/dist/cjs/utils/autoDecorateContent.cjs +1 -87
- package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -1
- package/dist/cjs/utils/buildFilesList.cjs +1 -50
- package/dist/cjs/utils/buildFilesList.cjs.map +1 -1
- package/dist/cjs/utils/chunkJSON.cjs +1 -336
- package/dist/cjs/utils/chunkJSON.cjs.map +1 -1
- package/dist/cjs/utils/formatter.cjs +1 -16
- package/dist/cjs/utils/formatter.cjs.map +1 -1
- package/dist/cjs/utils/getChunk.cjs +1 -34
- package/dist/cjs/utils/getChunk.cjs.map +1 -1
- package/dist/cjs/utils/getComponentTransformPattern.cjs +1 -48
- package/dist/cjs/utils/getComponentTransformPattern.cjs.map +1 -1
- package/dist/cjs/utils/getFileHash.cjs +1 -12
- package/dist/cjs/utils/getFileHash.cjs.map +1 -1
- package/dist/cjs/utils/getFormatFromExtension.cjs +1 -31
- package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +1 -46
- package/dist/cjs/utils/pLimit.cjs +1 -128
- package/dist/cjs/utils/pLimit.cjs.map +1 -1
- package/dist/cjs/utils/parallelize.cjs +1 -11
- package/dist/cjs/utils/parallelize.cjs.map +1 -1
- package/dist/cjs/utils/parallelizeGlobal.cjs +1 -29
- package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -1
- package/dist/cjs/utils/reduceObjectFormat.cjs +1 -31
- package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -1
- package/dist/cjs/utils/resolveObjectPromises.cjs +1 -21
- package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
- package/dist/cjs/utils/runOnce.cjs +1 -95
- package/dist/cjs/utils/runOnce.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/bin.cjs +1 -54
- package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/bootstrap.cjs +1 -24
- package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/index.cjs +1 -110
- package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/pidTree.cjs +1 -145
- package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/ps.cjs +1 -49
- package/dist/cjs/utils/runParallel/ps.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/runTask.cjs +1 -154
- package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/spawnPosix.cjs +1 -59
- package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/spawnWin32.cjs +1 -43
- package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/wmic.cjs +1 -52
- package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -1
- package/dist/cjs/utils/sortAlphabetically.cjs +1 -7
- package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
- package/dist/cjs/utils/splitTextByLine.cjs +1 -11
- package/dist/cjs/utils/splitTextByLine.cjs.map +1 -1
- package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +1 -60
- package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -1
- package/dist/cjs/watcher.cjs +1 -95
- package/dist/cjs/watcher.cjs.map +1 -1
- package/dist/cjs/writeConfiguration/index.cjs +1 -34
- package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +1 -28
- package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs +1 -31
- package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/index.cjs +1 -12
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +1 -93
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +2 -1775
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +1 -77
- package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +1 -123
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +1 -71
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
- package/dist/cjs/writeFileIfChanged.cjs +1 -12
- package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
- package/dist/cjs/writeJsonIfChanged.cjs +1 -17
- package/dist/cjs/writeJsonIfChanged.cjs.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -8
- package/dist/esm/_virtual/_utils_asset.mjs +2 -97
- package/dist/esm/build.mjs +1 -24
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +1 -51
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/index.mjs +1 -4
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs +1 -24
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +4 -75
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +4 -59
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +1 -44
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +1 -48
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +1 -56
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
- package/dist/esm/cleanOutputDir.mjs +1 -28
- package/dist/esm/cleanOutputDir.mjs.map +1 -1
- package/dist/esm/cleanRemovedContentDeclaration.mjs +1 -93
- package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -1
- package/dist/esm/cli.mjs +1 -8
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +1 -68
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +7 -39
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +1 -20
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +1 -21
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +1 -21
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +1 -20
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +1 -20
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/index.mjs +1 -9
- package/dist/esm/createType/createModuleAugmentation.mjs +9 -106
- package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
- package/dist/esm/createType/createType.mjs +1 -26
- package/dist/esm/createType/createType.mjs.map +1 -1
- package/dist/esm/createType/index.mjs +1 -4
- package/dist/esm/fetchDistantDictionaries.mjs +1 -48
- package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/filterInvalidDictionaries.mjs +1 -46
- package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
- package/dist/esm/formatDictionary.mjs +1 -44
- package/dist/esm/formatDictionary.mjs.map +1 -1
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +1 -37
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -1
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs +1 -32
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
- package/dist/esm/handleContentDeclarationFileChange.mjs +1 -47
- package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
- package/dist/esm/handleContentDeclarationFileMoved.mjs +1 -22
- package/dist/esm/handleContentDeclarationFileMoved.mjs.map +1 -1
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +1 -35
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -57
- package/dist/esm/init/index.mjs +1 -240
- package/dist/esm/init/index.mjs.map +1 -1
- package/dist/esm/init/utils/configManipulation.mjs +1 -161
- package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
- package/dist/esm/init/utils/fileSystem.mjs +1 -26
- package/dist/esm/init/utils/fileSystem.mjs.map +1 -1
- package/dist/esm/init/utils/index.mjs +1 -6
- package/dist/esm/init/utils/jsonParser.mjs +3 -40
- package/dist/esm/init/utils/jsonParser.mjs.map +1 -1
- package/dist/esm/init/utils/tsConfig.mjs +1 -16
- package/dist/esm/init/utils/tsConfig.mjs.map +1 -1
- package/dist/esm/initConfig/index.mjs +1 -36
- package/dist/esm/initConfig/index.mjs.map +1 -1
- package/dist/esm/installSkills/index.mjs +1 -167
- package/dist/esm/installSkills/index.mjs.map +1 -1
- package/dist/esm/listDictionariesPath.mjs +1 -37
- package/dist/esm/listDictionariesPath.mjs.map +1 -1
- package/dist/esm/listGitFiles.mjs +5 -90
- package/dist/esm/listGitFiles.mjs.map +1 -1
- package/dist/esm/listProjects.mjs +1 -43
- package/dist/esm/listProjects.mjs.map +1 -1
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +1 -65
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
- package/dist/esm/loadDictionaries/index.mjs +1 -6
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +2 -69
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -123
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +1 -26
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +1 -58
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/log.mjs +3 -132
- package/dist/esm/loadDictionaries/log.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +1 -92
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/reduceDictionaryContent/applyMask.mjs +1 -28
- package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -1
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +1 -10
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
- package/dist/esm/transformFiles/extractDictionaryKey.mjs +1 -14
- package/dist/esm/transformFiles/extractDictionaryKey.mjs.map +1 -1
- package/dist/esm/transformFiles/index.mjs +1 -4
- package/dist/esm/transformFiles/transformFiles.mjs +1 -244
- package/dist/esm/transformFiles/transformFiles.mjs.map +1 -1
- package/dist/esm/utils/autoDecorateContent.mjs +1 -85
- package/dist/esm/utils/autoDecorateContent.mjs.map +1 -1
- package/dist/esm/utils/buildFilesList.mjs +1 -47
- package/dist/esm/utils/buildFilesList.mjs.map +1 -1
- package/dist/esm/utils/chunkJSON.mjs +1 -333
- package/dist/esm/utils/chunkJSON.mjs.map +1 -1
- package/dist/esm/utils/formatter.mjs +1 -12
- package/dist/esm/utils/formatter.mjs.map +1 -1
- package/dist/esm/utils/getChunk.mjs +1 -33
- package/dist/esm/utils/getChunk.mjs.map +1 -1
- package/dist/esm/utils/getComponentTransformPattern.mjs +1 -44
- package/dist/esm/utils/getComponentTransformPattern.mjs.map +1 -1
- package/dist/esm/utils/getFileHash.mjs +1 -9
- package/dist/esm/utils/getFileHash.mjs.map +1 -1
- package/dist/esm/utils/getFormatFromExtension.mjs +1 -28
- package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +1 -20
- package/dist/esm/utils/pLimit.mjs +1 -125
- package/dist/esm/utils/pLimit.mjs.map +1 -1
- package/dist/esm/utils/parallelize.mjs +1 -10
- package/dist/esm/utils/parallelize.mjs.map +1 -1
- package/dist/esm/utils/parallelizeGlobal.mjs +1 -26
- package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -1
- package/dist/esm/utils/reduceObjectFormat.mjs +1 -29
- package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -1
- package/dist/esm/utils/resolveObjectPromises.mjs +1 -19
- package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -1
- package/dist/esm/utils/runOnce.mjs +1 -92
- package/dist/esm/utils/runOnce.mjs.map +1 -1
- package/dist/esm/utils/runParallel/bin.mjs +1 -52
- package/dist/esm/utils/runParallel/bin.mjs.map +1 -1
- package/dist/esm/utils/runParallel/bootstrap.mjs +1 -22
- package/dist/esm/utils/runParallel/bootstrap.mjs.map +1 -1
- package/dist/esm/utils/runParallel/index.mjs +1 -108
- package/dist/esm/utils/runParallel/index.mjs.map +1 -1
- package/dist/esm/utils/runParallel/pidTree.mjs +1 -142
- package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -1
- package/dist/esm/utils/runParallel/ps.mjs +1 -46
- package/dist/esm/utils/runParallel/ps.mjs.map +1 -1
- package/dist/esm/utils/runParallel/runTask.mjs +1 -152
- package/dist/esm/utils/runParallel/runTask.mjs.map +1 -1
- package/dist/esm/utils/runParallel/spawnPosix.mjs +1 -57
- package/dist/esm/utils/runParallel/spawnPosix.mjs.map +1 -1
- package/dist/esm/utils/runParallel/spawnWin32.mjs +1 -41
- package/dist/esm/utils/runParallel/spawnWin32.mjs.map +1 -1
- package/dist/esm/utils/runParallel/wmic.mjs +1 -49
- package/dist/esm/utils/runParallel/wmic.mjs.map +1 -1
- package/dist/esm/utils/sortAlphabetically.mjs +1 -5
- package/dist/esm/utils/sortAlphabetically.mjs.map +1 -1
- package/dist/esm/utils/splitTextByLine.mjs +1 -9
- package/dist/esm/utils/splitTextByLine.mjs.map +1 -1
- package/dist/esm/utils/verifyIdenticObjectFormat.mjs +1 -58
- package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -1
- package/dist/esm/watcher.mjs +1 -92
- package/dist/esm/watcher.mjs.map +1 -1
- package/dist/esm/writeConfiguration/index.mjs +1 -31
- package/dist/esm/writeConfiguration/index.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs +1 -26
- package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/detectFormatCommand.mjs +1 -29
- package/dist/esm/writeContentDeclaration/detectFormatCommand.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/index.mjs +1 -7
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +1 -91
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs +2 -1773
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/transformJSONFile.mjs +1 -75
- package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +1 -121
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +1 -69
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
- package/dist/esm/writeFileIfChanged.mjs +1 -10
- package/dist/esm/writeFileIfChanged.mjs.map +1 -1
- package/dist/esm/writeJsonIfChanged.mjs +1 -16
- package/dist/esm/writeJsonIfChanged.mjs.map +1 -1
- package/dist/types/build.d.ts +3 -1
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
- package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/index.d.ts +16 -24
- package/dist/types/initConfig/index.d.ts +1 -1
- package/dist/types/initConfig/index.d.ts.map +1 -1
- package/dist/types/listGitFiles.d.ts.map +1 -1
- package/dist/types/loadDictionaries/getIntlayerBundle.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
- package/dist/types/prepareIntlayer.d.ts.map +1 -1
- package/dist/types/transformFiles/transformFiles.d.ts +1 -1
- package/dist/types/transformFiles/transformFiles.d.ts.map +1 -1
- package/dist/types/utils/formatter.d.ts +1 -1
- package/dist/types/watcher.d.ts +1 -1
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -1
- package/package.json +10 -15
|
@@ -1,57 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { writeJsonIfChanged } from "../writeJsonIfChanged.mjs";
|
|
3
|
-
import { filterInvalidDictionaries } from "../filterInvalidDictionaries.mjs";
|
|
4
|
-
import { colorizePath, x } from "@intlayer/config";
|
|
5
|
-
import { mkdir } from "node:fs/promises";
|
|
6
|
-
import { resolve } from "node:path";
|
|
7
|
-
import { orderDictionaries } from "@intlayer/core";
|
|
8
|
-
|
|
9
|
-
//#region src/buildIntlayerDictionary/writeUnmergedDictionary.ts
|
|
10
|
-
const groupDictionariesByKey = (dictionaries) => dictionaries.reduce((acc, dictionary) => {
|
|
11
|
-
const key = dictionary.key;
|
|
12
|
-
if (!acc[key]) acc[key] = [];
|
|
13
|
-
acc[key].push(dictionary);
|
|
14
|
-
return acc;
|
|
15
|
-
}, {});
|
|
16
|
-
/**
|
|
17
|
-
* Write the unmerged dictionaries to the unmergedDictionariesDir
|
|
18
|
-
* @param dictionaries - The dictionaries to write
|
|
19
|
-
* @param configuration - The configuration
|
|
20
|
-
* @returns The grouped dictionaries
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);
|
|
25
|
-
* console.log(unmergedDictionaries);
|
|
26
|
-
*
|
|
27
|
-
* // .intlayer/unmerged_dictionaries/home.json
|
|
28
|
-
* // {
|
|
29
|
-
* // [
|
|
30
|
-
* // { key: 'home', content: { ... } },
|
|
31
|
-
* // { key: 'home', content: { ... } },
|
|
32
|
-
* // ],
|
|
33
|
-
* // }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
const writeUnmergedDictionaries = async (dictionaries, configuration) => {
|
|
37
|
-
const { unmergedDictionariesDir } = configuration.system;
|
|
38
|
-
await mkdir(resolve(unmergedDictionariesDir), { recursive: true });
|
|
39
|
-
const groupedDictionaries = groupDictionariesByKey(filterInvalidDictionaries(dictionaries, configuration, { checkSchema: true }));
|
|
40
|
-
const results = await parallelize(Object.entries(groupedDictionaries), async ([key, dictionaries]) => {
|
|
41
|
-
if (key === "undefined") return;
|
|
42
|
-
const orderedDictionaries = orderDictionaries(dictionaries, configuration);
|
|
43
|
-
const unmergedFilePath = resolve(unmergedDictionariesDir, `${key}.json`);
|
|
44
|
-
if (configuration.editor.enabled) await writeJsonIfChanged(unmergedFilePath, orderedDictionaries).catch((err) => {
|
|
45
|
-
console.error(`${x} Error creating unmerged ${colorizePath(unmergedFilePath)}:`, err);
|
|
46
|
-
});
|
|
47
|
-
return [key, {
|
|
48
|
-
dictionaryPath: unmergedFilePath,
|
|
49
|
-
dictionaries
|
|
50
|
-
}];
|
|
51
|
-
});
|
|
52
|
-
return Object.fromEntries(results.filter(Boolean));
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
//#endregion
|
|
56
|
-
export { groupDictionariesByKey, writeUnmergedDictionaries };
|
|
1
|
+
import{parallelize as e}from"../utils/parallelize.mjs";import{writeJsonIfChanged as t}from"../writeJsonIfChanged.mjs";import{filterInvalidDictionaries as n}from"../filterInvalidDictionaries.mjs";import{mkdir as r}from"node:fs/promises";import{resolve as i}from"node:path";import{colorizePath as a,x as o}from"@intlayer/config/logger";import{orderDictionaries as s}from"@intlayer/core/dictionaryManipulator";const c=e=>e.reduce((e,t)=>{let n=t.key;return e[n]||(e[n]=[]),e[n].push(t),e},{}),l=async(l,u)=>{let{unmergedDictionariesDir:d}=u.system;await r(i(d),{recursive:!0});let f=c(n(l,u,{checkSchema:!0})),p=await e(Object.entries(f),async([e,n])=>{if(e===`undefined`)return;let r=s(n,u),c=i(d,`${e}.json`);return u.editor.enabled&&await t(c,r).catch(e=>{console.error(`${o} Error creating unmerged ${a(c)}:`,e)}),[e,{dictionaryPath:c,dictionaries:n}]});return Object.fromEntries(p.filter(Boolean))};export{c as groupDictionariesByKey,l as writeUnmergedDictionaries};
|
|
57
2
|
//# sourceMappingURL=writeUnmergedDictionary.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeUnmergedDictionary.mjs","names":[],"sources":["../../../src/buildIntlayerDictionary/writeUnmergedDictionary.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { colorizePath, x } from '@intlayer/config';\nimport { orderDictionaries } from '@intlayer/core';\nimport type {\n Dictionary,\n DictionaryKey,\n IntlayerConfig,\n} from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { writeJsonIfChanged } from '../writeJsonIfChanged';\n\nexport const 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<\n DictionaryKey,\n UnmergedDictionaryResult\n>;\n\n/**\n * Write the unmerged dictionaries to the unmergedDictionariesDir\n * @param dictionaries - The dictionaries to write\n * @param configuration - The configuration\n * @returns The grouped dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * console.log(unmergedDictionaries);\n *\n * // .intlayer/unmerged_dictionaries/home.json\n * // {\n * // [\n * // { key: 'home', content: { ... } },\n * // { key: 'home', content: { ... } },\n * // ],\n * // }\n * ```\n */\nexport const writeUnmergedDictionaries = async (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Promise<UnmergedDictionaryOutput> => {\n const { unmergedDictionariesDir } = configuration.system;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(unmergedDictionariesDir), { recursive: true });\n\n const filteredDictionaries = filterInvalidDictionaries(\n dictionaries,\n configuration,\n { checkSchema: true }\n );\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 in disk if the editor is enabled\n // No need them if the editor is disabled\n if (configuration.editor.enabled) {\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\n return [\n key,\n {\n dictionaryPath: unmergedFilePath,\n dictionaries: dictionaries,\n } as UnmergedDictionaryResult,\n ] as const;\n }\n );\n\n return Object.fromEntries(\n results.filter(Boolean) as Array<\n readonly [string, UnmergedDictionaryResult]\n >\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeUnmergedDictionary.mjs","names":[],"sources":["../../../src/buildIntlayerDictionary/writeUnmergedDictionary.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { colorizePath, x } from '@intlayer/config/logger';\nimport { orderDictionaries } from '@intlayer/core/dictionaryManipulator';\nimport type {\n Dictionary,\n DictionaryKey,\n IntlayerConfig,\n} from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { writeJsonIfChanged } from '../writeJsonIfChanged';\n\nexport const 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<\n DictionaryKey,\n UnmergedDictionaryResult\n>;\n\n/**\n * Write the unmerged dictionaries to the unmergedDictionariesDir\n * @param dictionaries - The dictionaries to write\n * @param configuration - The configuration\n * @returns The grouped dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * console.log(unmergedDictionaries);\n *\n * // .intlayer/unmerged_dictionaries/home.json\n * // {\n * // [\n * // { key: 'home', content: { ... } },\n * // { key: 'home', content: { ... } },\n * // ],\n * // }\n * ```\n */\nexport const writeUnmergedDictionaries = async (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Promise<UnmergedDictionaryOutput> => {\n const { unmergedDictionariesDir } = configuration.system;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(unmergedDictionariesDir), { recursive: true });\n\n const filteredDictionaries = filterInvalidDictionaries(\n dictionaries,\n configuration,\n { checkSchema: true }\n );\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 in disk if the editor is enabled\n // No need them if the editor is disabled\n if (configuration.editor.enabled) {\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\n return [\n key,\n {\n dictionaryPath: unmergedFilePath,\n dictionaries: dictionaries,\n } as UnmergedDictionaryResult,\n ] as const;\n }\n );\n\n return Object.fromEntries(\n results.filter(Boolean) as Array<\n readonly [string, UnmergedDictionaryResult]\n >\n );\n};\n"],"mappings":"uZAaA,MAAa,EACX,GAEA,EAAa,QACV,EAAK,IAAe,CACnB,IAAM,EAAM,EAAW,IAKvB,OAJK,EAAI,KACP,EAAI,GAAO,EAAE,EAEf,EAAI,GAAK,KAAK,EAAW,CAClB,GAET,EAAE,CACH,CAgCU,EAA4B,MACvC,EACA,IACsC,CACtC,GAAM,CAAE,2BAA4B,EAAc,OAGlD,MAAM,EAAM,EAAQ,EAAwB,CAAE,CAAE,UAAW,GAAM,CAAC,CASlE,IAAM,EAAsB,EAPC,EAC3B,EACA,EACA,CAAE,YAAa,GAAM,CACtB,CAGuE,CAElE,EAAU,MAAM,EACpB,OAAO,QAAQ,EAAoB,CACnC,MAAO,CAAC,EAAK,KAAkB,CAC7B,GAAI,IAAQ,YACV,OAMF,IAAM,EAAsB,EAC1B,EACA,EACD,CAGK,EAAmB,EAAQ,EADV,GAAG,EAAI,OAC2C,CAezE,OAXI,EAAc,OAAO,SACvB,MAAM,EAAmB,EAAkB,EAAoB,CAAC,MAC7D,GAAQ,CACP,QAAQ,MACN,GAAG,EAAE,2BAA2B,EAAa,EAAiB,CAAC,GAC/D,EACD,EAEJ,CAGI,CACL,EACA,CACE,eAAgB,EACF,eACf,CACF,EAEJ,CAED,OAAO,OAAO,YACZ,EAAQ,OAAO,QAAQ,CAGxB"}
|
|
@@ -1,29 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getAppLogger } from "@intlayer/config/client";
|
|
3
|
-
import { existsSync } from "node:fs";
|
|
4
|
-
|
|
5
|
-
//#region src/cleanOutputDir.ts
|
|
6
|
-
const cleanOutputDir = async (configuration) => {
|
|
7
|
-
const { dictionariesDir, unmergedDictionariesDir, dynamicDictionariesDir, remoteDictionariesDir, fetchDictionariesDir, mainDir, typesDir, configDir, cacheDir } = configuration.system;
|
|
8
|
-
const appLogger = getAppLogger(configuration);
|
|
9
|
-
const directoriesToClean = [
|
|
10
|
-
dictionariesDir,
|
|
11
|
-
unmergedDictionariesDir,
|
|
12
|
-
dynamicDictionariesDir,
|
|
13
|
-
remoteDictionariesDir,
|
|
14
|
-
fetchDictionariesDir,
|
|
15
|
-
mainDir,
|
|
16
|
-
typesDir,
|
|
17
|
-
configDir,
|
|
18
|
-
cacheDir
|
|
19
|
-
];
|
|
20
|
-
await Promise.all(directoriesToClean.filter((dir) => existsSync(dir)).map((dir) => rm(dir, {
|
|
21
|
-
recursive: true,
|
|
22
|
-
force: true
|
|
23
|
-
})));
|
|
24
|
-
appLogger("Output directory cleaned", { isVerbose: true });
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
export { cleanOutputDir };
|
|
1
|
+
import{getAppLogger as e}from"@intlayer/config/client";import{rm as t}from"node:fs/promises";import{existsSync as n}from"node:fs";const r=async r=>{let{dictionariesDir:i,unmergedDictionariesDir:a,dynamicDictionariesDir:o,remoteDictionariesDir:s,fetchDictionariesDir:c,mainDir:l,typesDir:u,configDir:d,cacheDir:f}=r.system,p=e(r),m=[i,a,o,s,c,l,u,d,f];await Promise.all(m.filter(e=>n(e)).map(e=>t(e,{recursive:!0,force:!0}))),p(`Output directory cleaned`,{isVerbose:!0})};export{r as cleanOutputDir};
|
|
29
2
|
//# sourceMappingURL=cleanOutputDir.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanOutputDir.mjs","names":[],"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { rm } from 'node:fs/promises';\nimport { getAppLogger } from '@intlayer/config/client';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const cleanOutputDir = async (configuration: IntlayerConfig) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n remoteDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n cacheDir,\n } = configuration.system;\n\n const appLogger = getAppLogger(configuration);\n\n const directoriesToClean: string[] = [\n dictionariesDir, // Merged dictionaries\n unmergedDictionariesDir, // Unmerged dictionaries\n dynamicDictionariesDir, // Dynamic dictionaries\n remoteDictionariesDir, // Remote dictionaries\n fetchDictionariesDir, // Fetch dictionaries\n mainDir, // Main files\n typesDir, // Types\n configDir, // Configuration\n cacheDir, // Cache\n ];\n\n // Execute all deletions in parallel\n await Promise.all(\n directoriesToClean\n .filter((dir) => existsSync(dir))\n .map((dir) => rm(dir, { recursive: true, force: true }))\n );\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"cleanOutputDir.mjs","names":[],"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { rm } from 'node:fs/promises';\nimport { getAppLogger } from '@intlayer/config/client';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const cleanOutputDir = async (configuration: IntlayerConfig) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n remoteDictionariesDir,\n fetchDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n cacheDir,\n } = configuration.system;\n\n const appLogger = getAppLogger(configuration);\n\n const directoriesToClean: string[] = [\n dictionariesDir, // Merged dictionaries\n unmergedDictionariesDir, // Unmerged dictionaries\n dynamicDictionariesDir, // Dynamic dictionaries\n remoteDictionariesDir, // Remote dictionaries\n fetchDictionariesDir, // Fetch dictionaries\n mainDir, // Main files\n typesDir, // Types\n configDir, // Configuration\n cacheDir, // Cache\n ];\n\n // Execute all deletions in parallel\n await Promise.all(\n directoriesToClean\n .filter((dir) => existsSync(dir))\n .map((dir) => rm(dir, { recursive: true, force: true }))\n );\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":"kIAKA,MAAa,EAAiB,KAAO,IAAkC,CACrE,GAAM,CACJ,kBACA,0BACA,yBACA,wBACA,uBACA,UACA,WACA,YACA,YACE,EAAc,OAEZ,EAAY,EAAa,EAAc,CAEvC,EAA+B,CACnC,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CAGD,MAAM,QAAQ,IACZ,EACG,OAAQ,GAAQ,EAAW,EAAI,CAAC,CAChC,IAAK,GAAQ,EAAG,EAAK,CAAE,UAAW,GAAM,MAAO,GAAM,CAAC,CAAC,CAC3D,CAED,EAAU,2BAA4B,CACpC,UAAW,GACZ,CAAC"}
|
|
@@ -1,94 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
|
|
3
|
-
import { getUnmergedDictionaries } from "@intlayer/unmerged-dictionaries-entry";
|
|
4
|
-
import { readFile, rm } from "node:fs/promises";
|
|
5
|
-
import { join, normalize, relative } from "node:path";
|
|
6
|
-
import { colorizeKey, colorizePath, getAppLogger, normalizePath } from "@intlayer/config/client";
|
|
7
|
-
import fg from "fast-glob";
|
|
8
|
-
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
9
|
-
|
|
10
|
-
//#region src/cleanRemovedContentDeclaration.ts
|
|
11
|
-
const cleanRemovedContentDeclaration = async (filePath, keysToKeep, configuration) => {
|
|
12
|
-
const appLogger = getAppLogger(configuration);
|
|
13
|
-
const unmergedDictionaries = getUnmergedDictionaries(configuration);
|
|
14
|
-
const baseDir = configuration.content.baseDir;
|
|
15
|
-
const relativeFilePath = relative(baseDir, filePath);
|
|
16
|
-
const uniqueUnmergedDictionaries = Object.values(unmergedDictionaries).flat().filter((dictionary) => dictionary.filePath === relativeFilePath && !keysToKeep.includes(dictionary.key)).filter((dictionary, index, self) => index === self.findIndex((t) => t.key === dictionary.key));
|
|
17
|
-
const changedDictionariesLocalIds = [];
|
|
18
|
-
const filesToRemove = [];
|
|
19
|
-
const excludeKeys = [];
|
|
20
|
-
await Promise.all(uniqueUnmergedDictionaries.map(async (dictionary) => {
|
|
21
|
-
const unmergedFilePath = normalize(join(configuration.system.unmergedDictionariesDir, `${dictionary.key}.json`));
|
|
22
|
-
try {
|
|
23
|
-
const jsonContent = await readFile(unmergedFilePath, "utf8");
|
|
24
|
-
const parsedContent = JSON.parse(jsonContent);
|
|
25
|
-
if (parsedContent.length === 1) {
|
|
26
|
-
if (parsedContent[0].filePath === relativeFilePath) {
|
|
27
|
-
appLogger(`Removing outdated dictionary ${colorizeKey(dictionary.key)}`, { isVerbose: true });
|
|
28
|
-
filesToRemove.push(unmergedFilePath);
|
|
29
|
-
excludeKeys.push(dictionary.key);
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
await writeJsonIfChanged(unmergedFilePath, parsedContent.filter((content) => content.filePath !== relativeFilePath));
|
|
33
|
-
changedDictionariesLocalIds.push(dictionary.localId);
|
|
34
|
-
}
|
|
35
|
-
} catch (error) {
|
|
36
|
-
if (error.code === "ENOENT") {
|
|
37
|
-
if (!excludeKeys.includes(dictionary.key)) excludeKeys.push(dictionary.key);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
41
|
-
const dictionaries = getDictionaries(configuration);
|
|
42
|
-
const uniqueMergedDictionaries = (Object.values(dictionaries)?.filter((dictionary) => !keysToKeep.includes(dictionary.key) && dictionary.localIds?.length === 1 && dictionary.localIds[0].endsWith(`::local::${relativeFilePath}`))).filter((dictionary, index, self) => index === self.findIndex((t) => t.key === dictionary.key));
|
|
43
|
-
await Promise.all(uniqueMergedDictionaries.map(async (dictionary) => {
|
|
44
|
-
const mergedFilePath = normalize(join(configuration.system.dictionariesDir, `${dictionary.key}.json`));
|
|
45
|
-
try {
|
|
46
|
-
const fileContent = await readFile(mergedFilePath, "utf8");
|
|
47
|
-
const parsedContent = JSON.parse(fileContent);
|
|
48
|
-
if (parsedContent.localIds?.length === 1) {
|
|
49
|
-
if (parsedContent.localIds[0].endsWith(`::local::${relativeFilePath}`)) {
|
|
50
|
-
appLogger(`Removing outdated unmerged dictionary ${colorizeKey(dictionary.key)}`, { isVerbose: true });
|
|
51
|
-
filesToRemove.push(mergedFilePath);
|
|
52
|
-
const typesFilePath = normalize(join(configuration.system.typesDir, `${dictionary.key}.ts`));
|
|
53
|
-
filesToRemove.push(typesFilePath);
|
|
54
|
-
const dynamicFiles = await fg(normalizePath(join(configuration.system.dynamicDictionariesDir, `${dictionary.key}.*`)), { absolute: true });
|
|
55
|
-
filesToRemove.push(...dynamicFiles);
|
|
56
|
-
if (!excludeKeys.includes(dictionary.key)) excludeKeys.push(dictionary.key);
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
const localIds = parsedContent.localIds?.filter((localeId) => !localeId.endsWith(`::local::${relativeFilePath}`));
|
|
60
|
-
await writeJsonIfChanged(mergedFilePath, {
|
|
61
|
-
...parsedContent,
|
|
62
|
-
localIds
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
} catch (error) {
|
|
66
|
-
if (error.code === "ENOENT") {
|
|
67
|
-
if (!excludeKeys.includes(dictionary.key)) excludeKeys.push(dictionary.key);
|
|
68
|
-
const typesFilePath = normalize(join(configuration.system.typesDir, `${dictionary.key}.ts`));
|
|
69
|
-
filesToRemove.push(typesFilePath);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
73
|
-
if (filesToRemove.length > 0 || excludeKeys.length > 0) {
|
|
74
|
-
await createDictionaryEntryPoint(configuration, { excludeKeys });
|
|
75
|
-
if (filesToRemove.length > 0) await Promise.all(filesToRemove.map(async (path) => {
|
|
76
|
-
const relativePath = relative(baseDir, path);
|
|
77
|
-
try {
|
|
78
|
-
await rm(path, { force: true });
|
|
79
|
-
appLogger(`Deleted artifact: ${colorizePath(relativePath)}`, { isVerbose: true });
|
|
80
|
-
} catch {
|
|
81
|
-
appLogger(`Error while removing file ${colorizePath(relativePath)}`, { isVerbose: true });
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
changedDictionariesLocalIds,
|
|
87
|
-
excludeKeys,
|
|
88
|
-
hasRebuilt: filesToRemove.length > 0 || excludeKeys.length > 0
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
//#endregion
|
|
93
|
-
export { cleanRemovedContentDeclaration };
|
|
1
|
+
import{writeJsonIfChanged as e}from"./writeJsonIfChanged.mjs";import{createDictionaryEntryPoint as t}from"./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";import{colorizeKey as n,colorizePath as r,getAppLogger as i,normalizePath as a}from"@intlayer/config/client";import{getUnmergedDictionaries as o}from"@intlayer/unmerged-dictionaries-entry";import{readFile as s,rm as c}from"node:fs/promises";import{join as l,normalize as u,relative as d}from"node:path";import f from"fast-glob";import{getDictionaries as p}from"@intlayer/dictionaries-entry";const m=async(m,h,g)=>{let _=i(g),v=o(g),y=g.content.baseDir,b=d(y,m),x=Object.values(v).flat().filter(e=>e.filePath===b&&!h.includes(e.key)).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key)),S=[],C=[],w=[];await Promise.all(x.map(async t=>{let r=u(l(g.system.unmergedDictionariesDir,`${t.key}.json`));try{let i=await s(r,`utf8`),a=JSON.parse(i);a.length===1?a[0].filePath===b&&(_(`Removing outdated dictionary ${n(t.key)}`,{isVerbose:!0}),C.push(r),w.push(t.key)):(await e(r,a.filter(e=>e.filePath!==b)),S.push(t.localId))}catch(e){e.code===`ENOENT`&&(w.includes(t.key)||w.push(t.key))}}));let T=p(g),E=(Object.values(T)?.filter(e=>!h.includes(e.key)&&e.localIds?.length===1&&e.localIds[0].endsWith(`::local::${b}`))).filter((e,t,n)=>t===n.findIndex(t=>t.key===e.key));return await Promise.all(E.map(async t=>{let r=u(l(g.system.dictionariesDir,`${t.key}.json`));try{let i=await s(r,`utf8`),o=JSON.parse(i);if(o.localIds?.length===1){if(o.localIds[0].endsWith(`::local::${b}`)){_(`Removing outdated unmerged dictionary ${n(t.key)}`,{isVerbose:!0}),C.push(r);let e=u(l(g.system.typesDir,`${t.key}.ts`));C.push(e);let i=await f(a(l(g.system.dynamicDictionariesDir,`${t.key}.*`)),{absolute:!0});C.push(...i),w.includes(t.key)||w.push(t.key)}}else{let t=o.localIds?.filter(e=>!e.endsWith(`::local::${b}`));await e(r,{...o,localIds:t})}}catch(e){if(e.code===`ENOENT`){w.includes(t.key)||w.push(t.key);let e=u(l(g.system.typesDir,`${t.key}.ts`));C.push(e)}}})),(C.length>0||w.length>0)&&(await t(g,{excludeKeys:w}),C.length>0&&await Promise.all(C.map(async e=>{let t=d(y,e);try{await c(e,{force:!0}),_(`Deleted artifact: ${r(t)}`,{isVerbose:!0})}catch{_(`Error while removing file ${r(t)}`,{isVerbose:!0})}}))),{changedDictionariesLocalIds:S,excludeKeys:w,hasRebuilt:C.length>0||w.length>0}};export{m as cleanRemovedContentDeclaration};
|
|
94
2
|
//# sourceMappingURL=cleanRemovedContentDeclaration.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanRemovedContentDeclaration.mjs","names":[],"sources":["../../src/cleanRemovedContentDeclaration.ts"],"sourcesContent":["import { readFile, rm } from 'node:fs/promises';\nimport { join, normalize, relative } from 'node:path';\nimport {\n colorizeKey,\n colorizePath,\n getAppLogger,\n normalizePath,\n} from '@intlayer/config/client';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport fg from 'fast-glob';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint';\nimport { writeJsonIfChanged } from './writeJsonIfChanged';\n\nexport const cleanRemovedContentDeclaration = async (\n filePath: string,\n keysToKeep: string[],\n configuration: IntlayerConfig\n): Promise<{\n changedDictionariesLocalIds: string[];\n excludeKeys: string[];\n hasRebuilt: boolean;\n}> => {\n const appLogger = getAppLogger(configuration);\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const baseDir = configuration.content.baseDir;\n\n const relativeFilePath = relative(baseDir, filePath);\n const flatUnmergedDictionaries = Object.values(unmergedDictionaries).flat();\n\n const filteredUnmergedDictionaries = flatUnmergedDictionaries.filter(\n (dictionary) =>\n dictionary.filePath === relativeFilePath &&\n !keysToKeep.includes(dictionary.key)\n );\n\n // Deduplicate dictionaries by key\n const uniqueUnmergedDictionaries = filteredUnmergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n const changedDictionariesLocalIds: string[] = [];\n const filesToRemove: string[] = [];\n const excludeKeys: string[] = [];\n\n // Identify Unmerged Dictionaries to remove or clean\n await Promise.all(\n uniqueUnmergedDictionaries.map(async (dictionary) => {\n const unmergedFilePath = normalize(\n join(\n configuration.system.unmergedDictionariesDir,\n `${dictionary.key}.json`\n )\n );\n\n try {\n const jsonContent = await readFile(unmergedFilePath, 'utf8');\n const parsedContent = JSON.parse(jsonContent);\n\n if (parsedContent.length === 1) {\n if (parsedContent[0].filePath === relativeFilePath) {\n appLogger(\n `Removing outdated dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n filesToRemove.push(unmergedFilePath);\n excludeKeys.push(dictionary.key);\n }\n } else {\n const filteredContent = parsedContent.filter(\n (content: any) => content.filePath !== relativeFilePath\n );\n await writeJsonIfChanged(unmergedFilePath, filteredContent);\n changedDictionariesLocalIds.push(dictionary.localId!);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n }\n })\n );\n\n const dictionaries = getDictionaries(configuration);\n const flatDictionaries = Object.values(dictionaries) as Dictionary[];\n\n const filteredMergedDictionaries = flatDictionaries?.filter(\n (dictionary) =>\n !keysToKeep.includes(dictionary.key) &&\n dictionary.localIds?.length === 1 &&\n (dictionary.localIds[0] as string).endsWith(\n `::local::${relativeFilePath}`\n )\n );\n\n const uniqueMergedDictionaries = filteredMergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n // Identify Merged Dictionaries, Types, and Dynamic Dictionaries to remove\n await Promise.all(\n uniqueMergedDictionaries.map(async (dictionary) => {\n const mergedFilePath = normalize(\n join(configuration.system.dictionariesDir, `${dictionary.key}.json`)\n );\n\n try {\n const fileContent = await readFile(mergedFilePath, 'utf8');\n const parsedContent = JSON.parse(fileContent) as Dictionary;\n\n if (parsedContent.localIds?.length === 1) {\n if (\n parsedContent.localIds[0].endsWith(`::local::${relativeFilePath}`)\n ) {\n appLogger(\n `Removing outdated unmerged dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n\n // Mark JSON for removal\n filesToRemove.push(mergedFilePath);\n\n // Mark TS Types for removal\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n\n // Mark Dynamic Dictionaries for removal\n // We use glob to catch the loader files (.cjs, .mjs) AND the split locale files (.en.json, etc.)\n const dynamicFilesGlob = join(\n configuration.system.dynamicDictionariesDir,\n `${dictionary.key}.*`\n );\n const dynamicFiles = await fg(normalizePath(dynamicFilesGlob), {\n absolute: true,\n });\n filesToRemove.push(...dynamicFiles);\n\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n } else {\n const localIds = parsedContent.localIds?.filter(\n (localeId) => !localeId.endsWith(`::local::${relativeFilePath}`)\n ) as string[];\n const newContent = { ...parsedContent, localIds };\n await writeJsonIfChanged(mergedFilePath, newContent);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n }\n }\n })\n );\n\n // Execute Cleanup\n if (filesToRemove.length > 0 || excludeKeys.length > 0) {\n // Update entry points (indexes) first so the app doesn't import dead files\n await createDictionaryEntryPoint(configuration, { excludeKeys });\n\n // Remove the files synchronously (awaited) immediately after.\n if (filesToRemove.length > 0) {\n await Promise.all(\n filesToRemove.map(async (path) => {\n const relativePath = relative(baseDir, path);\n try {\n await rm(path, { force: true });\n\n appLogger(`Deleted artifact: ${colorizePath(relativePath)}`, {\n isVerbose: true,\n });\n } catch {\n appLogger(\n `Error while removing file ${colorizePath(relativePath)}`,\n {\n isVerbose: true,\n }\n );\n }\n })\n );\n }\n }\n\n return {\n changedDictionariesLocalIds,\n excludeKeys,\n hasRebuilt: filesToRemove.length > 0 || excludeKeys.length > 0,\n };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"cleanRemovedContentDeclaration.mjs","names":[],"sources":["../../src/cleanRemovedContentDeclaration.ts"],"sourcesContent":["import { readFile, rm } from 'node:fs/promises';\nimport { join, normalize, relative } from 'node:path';\nimport {\n colorizeKey,\n colorizePath,\n getAppLogger,\n normalizePath,\n} from '@intlayer/config/client';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport fg from 'fast-glob';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint';\nimport { writeJsonIfChanged } from './writeJsonIfChanged';\n\nexport const cleanRemovedContentDeclaration = async (\n filePath: string,\n keysToKeep: string[],\n configuration: IntlayerConfig\n): Promise<{\n changedDictionariesLocalIds: string[];\n excludeKeys: string[];\n hasRebuilt: boolean;\n}> => {\n const appLogger = getAppLogger(configuration);\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const baseDir = configuration.content.baseDir;\n\n const relativeFilePath = relative(baseDir, filePath);\n const flatUnmergedDictionaries = Object.values(unmergedDictionaries).flat();\n\n const filteredUnmergedDictionaries = flatUnmergedDictionaries.filter(\n (dictionary) =>\n dictionary.filePath === relativeFilePath &&\n !keysToKeep.includes(dictionary.key)\n );\n\n // Deduplicate dictionaries by key\n const uniqueUnmergedDictionaries = filteredUnmergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n const changedDictionariesLocalIds: string[] = [];\n const filesToRemove: string[] = [];\n const excludeKeys: string[] = [];\n\n // Identify Unmerged Dictionaries to remove or clean\n await Promise.all(\n uniqueUnmergedDictionaries.map(async (dictionary) => {\n const unmergedFilePath = normalize(\n join(\n configuration.system.unmergedDictionariesDir,\n `${dictionary.key}.json`\n )\n );\n\n try {\n const jsonContent = await readFile(unmergedFilePath, 'utf8');\n const parsedContent = JSON.parse(jsonContent);\n\n if (parsedContent.length === 1) {\n if (parsedContent[0].filePath === relativeFilePath) {\n appLogger(\n `Removing outdated dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n filesToRemove.push(unmergedFilePath);\n excludeKeys.push(dictionary.key);\n }\n } else {\n const filteredContent = parsedContent.filter(\n (content: any) => content.filePath !== relativeFilePath\n );\n await writeJsonIfChanged(unmergedFilePath, filteredContent);\n changedDictionariesLocalIds.push(dictionary.localId!);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n }\n })\n );\n\n const dictionaries = getDictionaries(configuration);\n const flatDictionaries = Object.values(dictionaries) as Dictionary[];\n\n const filteredMergedDictionaries = flatDictionaries?.filter(\n (dictionary) =>\n !keysToKeep.includes(dictionary.key) &&\n dictionary.localIds?.length === 1 &&\n (dictionary.localIds[0] as string).endsWith(\n `::local::${relativeFilePath}`\n )\n );\n\n const uniqueMergedDictionaries = filteredMergedDictionaries.filter(\n (dictionary, index, self) =>\n index === self.findIndex((t) => t.key === dictionary.key)\n );\n\n // Identify Merged Dictionaries, Types, and Dynamic Dictionaries to remove\n await Promise.all(\n uniqueMergedDictionaries.map(async (dictionary) => {\n const mergedFilePath = normalize(\n join(configuration.system.dictionariesDir, `${dictionary.key}.json`)\n );\n\n try {\n const fileContent = await readFile(mergedFilePath, 'utf8');\n const parsedContent = JSON.parse(fileContent) as Dictionary;\n\n if (parsedContent.localIds?.length === 1) {\n if (\n parsedContent.localIds[0].endsWith(`::local::${relativeFilePath}`)\n ) {\n appLogger(\n `Removing outdated unmerged dictionary ${colorizeKey(dictionary.key)}`,\n { isVerbose: true }\n );\n\n // Mark JSON for removal\n filesToRemove.push(mergedFilePath);\n\n // Mark TS Types for removal\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n\n // Mark Dynamic Dictionaries for removal\n // We use glob to catch the loader files (.cjs, .mjs) AND the split locale files (.en.json, etc.)\n const dynamicFilesGlob = join(\n configuration.system.dynamicDictionariesDir,\n `${dictionary.key}.*`\n );\n const dynamicFiles = await fg(normalizePath(dynamicFilesGlob), {\n absolute: true,\n });\n filesToRemove.push(...dynamicFiles);\n\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n }\n } else {\n const localIds = parsedContent.localIds?.filter(\n (localeId) => !localeId.endsWith(`::local::${relativeFilePath}`)\n ) as string[];\n const newContent = { ...parsedContent, localIds };\n await writeJsonIfChanged(mergedFilePath, newContent);\n }\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n if (!excludeKeys.includes(dictionary.key)) {\n excludeKeys.push(dictionary.key);\n }\n const typesFilePath = normalize(\n join(configuration.system.typesDir, `${dictionary.key}.ts`)\n );\n filesToRemove.push(typesFilePath);\n }\n }\n })\n );\n\n // Execute Cleanup\n if (filesToRemove.length > 0 || excludeKeys.length > 0) {\n // Update entry points (indexes) first so the app doesn't import dead files\n await createDictionaryEntryPoint(configuration, { excludeKeys });\n\n // Remove the files synchronously (awaited) immediately after.\n if (filesToRemove.length > 0) {\n await Promise.all(\n filesToRemove.map(async (path) => {\n const relativePath = relative(baseDir, path);\n try {\n await rm(path, { force: true });\n\n appLogger(`Deleted artifact: ${colorizePath(relativePath)}`, {\n isVerbose: true,\n });\n } catch {\n appLogger(\n `Error while removing file ${colorizePath(relativePath)}`,\n {\n isVerbose: true,\n }\n );\n }\n })\n );\n }\n }\n\n return {\n changedDictionariesLocalIds,\n excludeKeys,\n hasRebuilt: filesToRemove.length > 0 || excludeKeys.length > 0,\n };\n};\n"],"mappings":"8iBAeA,MAAa,EAAiC,MAC5C,EACA,EACA,IAKI,CACJ,IAAM,EAAY,EAAa,EAAc,CAEvC,EAAuB,EAAwB,EAAc,CAE7D,EAAU,EAAc,QAAQ,QAEhC,EAAmB,EAAS,EAAS,EAAS,CAU9C,EAT2B,OAAO,OAAO,EAAqB,CAAC,MAAM,CAEb,OAC3D,GACC,EAAW,WAAa,GACxB,CAAC,EAAW,SAAS,EAAW,IAAI,CACvC,CAG+D,QAC7D,EAAY,EAAO,IAClB,IAAU,EAAK,UAAW,GAAM,EAAE,MAAQ,EAAW,IAAI,CAC5D,CAEK,EAAwC,EAAE,CAC1C,EAA0B,EAAE,CAC5B,EAAwB,EAAE,CAGhC,MAAM,QAAQ,IACZ,EAA2B,IAAI,KAAO,IAAe,CACnD,IAAM,EAAmB,EACvB,EACE,EAAc,OAAO,wBACrB,GAAG,EAAW,IAAI,OACnB,CACF,CAED,GAAI,CACF,IAAM,EAAc,MAAM,EAAS,EAAkB,OAAO,CACtD,EAAgB,KAAK,MAAM,EAAY,CAEzC,EAAc,SAAW,EACvB,EAAc,GAAG,WAAa,IAChC,EACE,gCAAgC,EAAY,EAAW,IAAI,GAC3D,CAAE,UAAW,GAAM,CACpB,CACD,EAAc,KAAK,EAAiB,CACpC,EAAY,KAAK,EAAW,IAAI,GAMlC,MAAM,EAAmB,EAHD,EAAc,OACnC,GAAiB,EAAQ,WAAa,EACxC,CAC0D,CAC3D,EAA4B,KAAK,EAAW,QAAS,QAEhD,EAAY,CACf,EAAM,OAAS,WACZ,EAAY,SAAS,EAAW,IAAI,EACvC,EAAY,KAAK,EAAW,IAAI,IAItC,CACH,CAED,IAAM,EAAe,EAAgB,EAAc,CAY7C,GAXmB,OAAO,OAAO,EAAa,EAEC,OAClD,GACC,CAAC,EAAW,SAAS,EAAW,IAAI,EACpC,EAAW,UAAU,SAAW,GAC/B,EAAW,SAAS,GAAc,SACjC,YAAY,IACb,CACJ,EAE2D,QACzD,EAAY,EAAO,IAClB,IAAU,EAAK,UAAW,GAAM,EAAE,MAAQ,EAAW,IAAI,CAC5D,CAgGD,OA7FA,MAAM,QAAQ,IACZ,EAAyB,IAAI,KAAO,IAAe,CACjD,IAAM,EAAiB,EACrB,EAAK,EAAc,OAAO,gBAAiB,GAAG,EAAW,IAAI,OAAO,CACrE,CAED,GAAI,CACF,IAAM,EAAc,MAAM,EAAS,EAAgB,OAAO,CACpD,EAAgB,KAAK,MAAM,EAAY,CAE7C,GAAI,EAAc,UAAU,SAAW,MAEnC,EAAc,SAAS,GAAG,SAAS,YAAY,IAAmB,CAClE,CACA,EACE,yCAAyC,EAAY,EAAW,IAAI,GACpE,CAAE,UAAW,GAAM,CACpB,CAGD,EAAc,KAAK,EAAe,CAGlC,IAAM,EAAgB,EACpB,EAAK,EAAc,OAAO,SAAU,GAAG,EAAW,IAAI,KAAK,CAC5D,CACD,EAAc,KAAK,EAAc,CAQjC,IAAM,EAAe,MAAM,EAAG,EAJL,EACvB,EAAc,OAAO,uBACrB,GAAG,EAAW,IAAI,IACnB,CAC4D,CAAE,CAC7D,SAAU,GACX,CAAC,CACF,EAAc,KAAK,GAAG,EAAa,CAE9B,EAAY,SAAS,EAAW,IAAI,EACvC,EAAY,KAAK,EAAW,IAAI,MAG/B,CACL,IAAM,EAAW,EAAc,UAAU,OACtC,GAAa,CAAC,EAAS,SAAS,YAAY,IAAmB,CACjE,CAED,MAAM,EAAmB,EADN,CAAE,GAAG,EAAe,WAAU,CACG,QAE/C,EAAY,CACnB,GAAI,EAAM,OAAS,SAAU,CACtB,EAAY,SAAS,EAAW,IAAI,EACvC,EAAY,KAAK,EAAW,IAAI,CAElC,IAAM,EAAgB,EACpB,EAAK,EAAc,OAAO,SAAU,GAAG,EAAW,IAAI,KAAK,CAC5D,CACD,EAAc,KAAK,EAAc,IAGrC,CACH,EAGG,EAAc,OAAS,GAAK,EAAY,OAAS,KAEnD,MAAM,EAA2B,EAAe,CAAE,cAAa,CAAC,CAG5D,EAAc,OAAS,GACzB,MAAM,QAAQ,IACZ,EAAc,IAAI,KAAO,IAAS,CAChC,IAAM,EAAe,EAAS,EAAS,EAAK,CAC5C,GAAI,CACF,MAAM,EAAG,EAAM,CAAE,MAAO,GAAM,CAAC,CAE/B,EAAU,qBAAqB,EAAa,EAAa,GAAI,CAC3D,UAAW,GACZ,CAAC,MACI,CACN,EACE,6BAA6B,EAAa,EAAa,GACvD,CACE,UAAW,GACZ,CACF,GAEH,CACH,EAIE,CACL,8BACA,cACA,WAAY,EAAc,OAAS,GAAK,EAAY,OAAS,EAC9D"}
|
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SKILLS, SKILLS_METADATA, installSkills } from "./installSkills/index.mjs";
|
|
3
|
-
import { listGitFiles, listGitLines } from "./listGitFiles.mjs";
|
|
4
|
-
import { listProjects } from "./listProjects.mjs";
|
|
5
|
-
import { extractDictionaryKey } from "./transformFiles/extractDictionaryKey.mjs";
|
|
6
|
-
import { ATTRIBUTES_TO_EXTRACT, extractIntlayer, generateKey, shouldExtract, transformFiles } from "./transformFiles/transformFiles.mjs";
|
|
7
|
-
|
|
8
|
-
export { ATTRIBUTES_TO_EXTRACT, SKILLS, SKILLS_METADATA, extractDictionaryKey, extractIntlayer, generateKey, initIntlayer, installSkills, listGitFiles, listGitLines, listProjects, shouldExtract, transformFiles };
|
|
1
|
+
import{initIntlayer as e}from"./init/index.mjs";import{SKILLS as t,SKILLS_METADATA as n,installSkills as r}from"./installSkills/index.mjs";import{listGitFiles as i,listGitLines as a}from"./listGitFiles.mjs";import{listProjects as o}from"./listProjects.mjs";import{extractDictionaryKey as s}from"./transformFiles/extractDictionaryKey.mjs";import{ATTRIBUTES_TO_EXTRACT as c,extractIntlayer as l,generateKey as u,shouldExtract as d,transformFiles as f}from"./transformFiles/transformFiles.mjs";export{c as ATTRIBUTES_TO_EXTRACT,t as SKILLS,n as SKILLS_METADATA,s as extractDictionaryKey,l as extractIntlayer,u as generateKey,e as initIntlayer,r as installSkills,i as listGitFiles,a as listGitLines,o as listProjects,d as shouldExtract,f as transformFiles};
|
|
@@ -1,69 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { writeFileIfChanged } from "../writeFileIfChanged.mjs";
|
|
3
|
-
import { generateDictionaryListContent } from "./generateDictionaryListContent.mjs";
|
|
4
|
-
import { getBuiltDictionariesPath } from "./getBuiltDictionariesPath.mjs";
|
|
5
|
-
import { getBuiltDynamicDictionariesPath } from "./getBuiltDynamicDictionariesPath.mjs";
|
|
6
|
-
import { getBuiltFetchDictionariesPath } from "./getBuiltFetchDictionariesPath.mjs";
|
|
7
|
-
import { getBuiltRemoteDictionariesPath } from "./getBuiltRemoteDictionariesPath.mjs";
|
|
8
|
-
import { getBuiltUnmergedDictionariesPath } from "./getBuiltUnmergedDictionariesPath.mjs";
|
|
9
|
-
import { getConfiguration } from "@intlayer/config";
|
|
10
|
-
import { mkdir } from "node:fs/promises";
|
|
11
|
-
import { resolve } from "node:path";
|
|
12
|
-
|
|
13
|
-
//#region src/createDictionaryEntryPoint/createDictionaryEntryPoint.ts
|
|
14
|
-
const writeDictionaryFiles = async (paths, fileName, importType, functionName, format, configuration = getConfiguration()) => {
|
|
15
|
-
const content = generateDictionaryListContent(await paths, functionName, importType, format, configuration);
|
|
16
|
-
const extension = format === "cjs" ? "cjs" : "mjs";
|
|
17
|
-
const { mainDir } = configuration.system;
|
|
18
|
-
await writeFileIfChanged(resolve(mainDir, `${fileName}.${extension}`), content);
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* This function generates a list of dictionaries in the main directory
|
|
22
|
-
*/
|
|
23
|
-
const createDictionaryEntryPoint = async (configuration = getConfiguration(), options = {}) => {
|
|
24
|
-
const { formats, excludeKeys = [] } = options;
|
|
25
|
-
const outputFormats = formats ?? configuration.build.outputFormat;
|
|
26
|
-
const { mainDir } = configuration.system;
|
|
27
|
-
await mkdir(mainDir, { recursive: true });
|
|
28
|
-
await parallelize([
|
|
29
|
-
...outputFormats.map((format) => ({
|
|
30
|
-
paths: getBuiltDictionariesPath(configuration, excludeKeys),
|
|
31
|
-
importType: "json",
|
|
32
|
-
functionName: "getDictionaries",
|
|
33
|
-
fileName: "dictionaries",
|
|
34
|
-
format
|
|
35
|
-
})),
|
|
36
|
-
...outputFormats.map((format) => ({
|
|
37
|
-
paths: getBuiltUnmergedDictionariesPath(configuration, excludeKeys),
|
|
38
|
-
importType: "json",
|
|
39
|
-
functionName: "getUnmergedDictionaries",
|
|
40
|
-
fileName: "unmerged_dictionaries",
|
|
41
|
-
format
|
|
42
|
-
})),
|
|
43
|
-
...outputFormats.map((format) => ({
|
|
44
|
-
paths: getBuiltDynamicDictionariesPath(configuration, format, excludeKeys),
|
|
45
|
-
importType: "javascript",
|
|
46
|
-
functionName: "getDynamicDictionaries",
|
|
47
|
-
fileName: "dynamic_dictionaries",
|
|
48
|
-
format
|
|
49
|
-
})),
|
|
50
|
-
...outputFormats.map((format) => ({
|
|
51
|
-
paths: getBuiltFetchDictionariesPath(configuration, format, excludeKeys),
|
|
52
|
-
importType: "javascript",
|
|
53
|
-
functionName: "getFetchDictionaries",
|
|
54
|
-
fileName: "fetch_dictionaries",
|
|
55
|
-
format
|
|
56
|
-
})),
|
|
57
|
-
...outputFormats.map((format) => ({
|
|
58
|
-
paths: getBuiltRemoteDictionariesPath(configuration, excludeKeys),
|
|
59
|
-
importType: "json",
|
|
60
|
-
functionName: "getRemoteDictionaries",
|
|
61
|
-
fileName: "remote_dictionaries",
|
|
62
|
-
format
|
|
63
|
-
}))
|
|
64
|
-
], async ({ paths, fileName, format, functionName, importType }) => writeDictionaryFiles(paths, fileName, importType, functionName, format, configuration));
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
export { createDictionaryEntryPoint };
|
|
1
|
+
import{parallelize as e}from"../utils/parallelize.mjs";import{writeFileIfChanged as t}from"../writeFileIfChanged.mjs";import{generateDictionaryListContent as n}from"./generateDictionaryListContent.mjs";import{getBuiltDictionariesPath as r}from"./getBuiltDictionariesPath.mjs";import{getBuiltDynamicDictionariesPath as i}from"./getBuiltDynamicDictionariesPath.mjs";import{getBuiltFetchDictionariesPath as a}from"./getBuiltFetchDictionariesPath.mjs";import{getBuiltRemoteDictionariesPath as o}from"./getBuiltRemoteDictionariesPath.mjs";import{getBuiltUnmergedDictionariesPath as s}from"./getBuiltUnmergedDictionariesPath.mjs";import{getConfiguration as c}from"@intlayer/config/node";import{mkdir as l}from"node:fs/promises";import{resolve as u}from"node:path";const d=async(e,r,i,a,o,s=c())=>{let l=n(await e,a,i,o,s),d=o===`cjs`?`cjs`:`mjs`,{mainDir:f}=s.system;await t(u(f,`${r}.${d}`),l)},f=async(t=c(),n={})=>{let{formats:u,excludeKeys:f=[]}=n,p=u??t.build.outputFormat,{mainDir:m}=t.system;await l(m,{recursive:!0}),await e([...p.map(e=>({paths:r(t,f),importType:`json`,functionName:`getDictionaries`,fileName:`dictionaries`,format:e})),...p.map(e=>({paths:s(t,f),importType:`json`,functionName:`getUnmergedDictionaries`,fileName:`unmerged_dictionaries`,format:e})),...p.map(e=>({paths:i(t,e,f),importType:`javascript`,functionName:`getDynamicDictionaries`,fileName:`dynamic_dictionaries`,format:e})),...p.map(e=>({paths:a(t,e,f),importType:`javascript`,functionName:`getFetchDictionaries`,fileName:`fetch_dictionaries`,format:e})),...p.map(e=>({paths:o(t,f),importType:`json`,functionName:`getRemoteDictionaries`,fileName:`remote_dictionaries`,format:e}))],async({paths:e,fileName:n,format:r,functionName:i,importType:a})=>d(e,n,a,i,r,t))};export{f as createDictionaryEntryPoint};
|
|
69
2
|
//# sourceMappingURL=createDictionaryEntryPoint.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDictionaryEntryPoint.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/createDictionaryEntryPoint.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config';\nimport { parallelize } from '../utils/parallelize';\nimport { writeFileIfChanged } from '../writeFileIfChanged';\nimport { generateDictionaryListContent } from './generateDictionaryListContent';\nimport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nimport { getBuiltDynamicDictionariesPath } from './getBuiltDynamicDictionariesPath';\nimport { getBuiltFetchDictionariesPath } from './getBuiltFetchDictionariesPath';\nimport { getBuiltRemoteDictionariesPath } from './getBuiltRemoteDictionariesPath';\nimport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\n\nconst writeDictionaryFiles = async (\n paths: Promise<string[]>,\n fileName: string,\n importType: 'json' | 'javascript',\n functionName: string,\n format: 'cjs' | 'esm',\n configuration = getConfiguration()\n) => {\n const content = generateDictionaryListContent(\n await paths,\n functionName,\n importType,\n format,\n configuration\n );\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const { mainDir } = configuration.system;\n\n await writeFileIfChanged(\n resolve(mainDir, `${fileName}.${extension}`),\n content\n );\n};\n\nexport type CreateDictionaryEntryPointOptions = {\n formats?: ('cjs' | 'esm')[];\n excludeKeys?: string[];\n};\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const createDictionaryEntryPoint = async (\n configuration = getConfiguration(),\n options: CreateDictionaryEntryPointOptions = {}\n) => {\n const { formats, excludeKeys = [] } = options;\n const outputFormats = formats ?? configuration.build.outputFormat;\n const { mainDir } = configuration.system;\n\n await mkdir(mainDir, { recursive: true });\n\n const writeOperations = [\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltDictionariesPath(configuration, excludeKeys),\n importType: 'json',\n functionName: 'getDictionaries',\n fileName: 'dictionaries' as const,\n format,\n }) as const\n ),\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltUnmergedDictionariesPath(configuration, excludeKeys),\n importType: 'json',\n functionName: 'getUnmergedDictionaries',\n fileName: 'unmerged_dictionaries' as const,\n format,\n }) as const\n ),\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltDynamicDictionariesPath(\n configuration,\n format,\n excludeKeys\n ),\n importType: 'javascript',\n functionName: 'getDynamicDictionaries',\n fileName: 'dynamic_dictionaries' as const,\n format,\n }) as const\n ),\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltFetchDictionariesPath(\n configuration,\n format,\n excludeKeys\n ),\n importType: 'javascript',\n functionName: 'getFetchDictionaries',\n fileName: 'fetch_dictionaries' as const,\n format,\n }) as const\n ),\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltRemoteDictionariesPath(configuration, excludeKeys),\n importType: 'json',\n functionName: 'getRemoteDictionaries',\n fileName: 'remote_dictionaries' as const,\n format,\n }) as const\n ),\n ];\n\n await parallelize(\n writeOperations,\n async ({ paths, fileName, format, functionName, importType }) =>\n writeDictionaryFiles(\n paths,\n fileName,\n importType,\n functionName,\n format,\n configuration\n )\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createDictionaryEntryPoint.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/createDictionaryEntryPoint.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { parallelize } from '../utils/parallelize';\nimport { writeFileIfChanged } from '../writeFileIfChanged';\nimport { generateDictionaryListContent } from './generateDictionaryListContent';\nimport { getBuiltDictionariesPath } from './getBuiltDictionariesPath';\nimport { getBuiltDynamicDictionariesPath } from './getBuiltDynamicDictionariesPath';\nimport { getBuiltFetchDictionariesPath } from './getBuiltFetchDictionariesPath';\nimport { getBuiltRemoteDictionariesPath } from './getBuiltRemoteDictionariesPath';\nimport { getBuiltUnmergedDictionariesPath } from './getBuiltUnmergedDictionariesPath';\n\nconst writeDictionaryFiles = async (\n paths: Promise<string[]>,\n fileName: string,\n importType: 'json' | 'javascript',\n functionName: string,\n format: 'cjs' | 'esm',\n configuration = getConfiguration()\n) => {\n const content = generateDictionaryListContent(\n await paths,\n functionName,\n importType,\n format,\n configuration\n );\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const { mainDir } = configuration.system;\n\n await writeFileIfChanged(\n resolve(mainDir, `${fileName}.${extension}`),\n content\n );\n};\n\nexport type CreateDictionaryEntryPointOptions = {\n formats?: ('cjs' | 'esm')[];\n excludeKeys?: string[];\n};\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const createDictionaryEntryPoint = async (\n configuration = getConfiguration(),\n options: CreateDictionaryEntryPointOptions = {}\n) => {\n const { formats, excludeKeys = [] } = options;\n const outputFormats = formats ?? configuration.build.outputFormat;\n const { mainDir } = configuration.system;\n\n await mkdir(mainDir, { recursive: true });\n\n const writeOperations = [\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltDictionariesPath(configuration, excludeKeys),\n importType: 'json',\n functionName: 'getDictionaries',\n fileName: 'dictionaries' as const,\n format,\n }) as const\n ),\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltUnmergedDictionariesPath(configuration, excludeKeys),\n importType: 'json',\n functionName: 'getUnmergedDictionaries',\n fileName: 'unmerged_dictionaries' as const,\n format,\n }) as const\n ),\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltDynamicDictionariesPath(\n configuration,\n format,\n excludeKeys\n ),\n importType: 'javascript',\n functionName: 'getDynamicDictionaries',\n fileName: 'dynamic_dictionaries' as const,\n format,\n }) as const\n ),\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltFetchDictionariesPath(\n configuration,\n format,\n excludeKeys\n ),\n importType: 'javascript',\n functionName: 'getFetchDictionaries',\n fileName: 'fetch_dictionaries' as const,\n format,\n }) as const\n ),\n ...outputFormats.map(\n (format) =>\n ({\n paths: getBuiltRemoteDictionariesPath(configuration, excludeKeys),\n importType: 'json',\n functionName: 'getRemoteDictionaries',\n fileName: 'remote_dictionaries' as const,\n format,\n }) as const\n ),\n ];\n\n await parallelize(\n writeOperations,\n async ({ paths, fileName, format, functionName, importType }) =>\n writeDictionaryFiles(\n paths,\n fileName,\n importType,\n functionName,\n format,\n configuration\n )\n );\n};\n"],"mappings":"svBAYA,MAAM,EAAuB,MAC3B,EACA,EACA,EACA,EACA,EACA,EAAgB,GAAkB,GAC/B,CACH,IAAM,EAAU,EACd,MAAM,EACN,EACA,EACA,EACA,EACD,CACK,EAAY,IAAW,MAAQ,MAAQ,MAEvC,CAAE,WAAY,EAAc,OAElC,MAAM,EACJ,EAAQ,EAAS,GAAG,EAAS,GAAG,IAAY,CAC5C,EACD,EAWU,EAA6B,MACxC,EAAgB,GAAkB,CAClC,EAA6C,EAAE,GAC5C,CACH,GAAM,CAAE,UAAS,cAAc,EAAE,EAAK,EAChC,EAAgB,GAAW,EAAc,MAAM,aAC/C,CAAE,WAAY,EAAc,OAElC,MAAM,EAAM,EAAS,CAAE,UAAW,GAAM,CAAC,CA+DzC,MAAM,EA7DkB,CACtB,GAAG,EAAc,IACd,IACE,CACC,MAAO,EAAyB,EAAe,EAAY,CAC3D,WAAY,OACZ,aAAc,kBACd,SAAU,eACV,SACD,EACJ,CACD,GAAG,EAAc,IACd,IACE,CACC,MAAO,EAAiC,EAAe,EAAY,CACnE,WAAY,OACZ,aAAc,0BACd,SAAU,wBACV,SACD,EACJ,CACD,GAAG,EAAc,IACd,IACE,CACC,MAAO,EACL,EACA,EACA,EACD,CACD,WAAY,aACZ,aAAc,yBACd,SAAU,uBACV,SACD,EACJ,CACD,GAAG,EAAc,IACd,IACE,CACC,MAAO,EACL,EACA,EACA,EACD,CACD,WAAY,aACZ,aAAc,uBACd,SAAU,qBACV,SACD,EACJ,CACD,GAAG,EAAc,IACd,IACE,CACC,MAAO,EAA+B,EAAe,EAAY,CACjE,WAAY,OACZ,aAAc,wBACd,SAAU,sBACV,SACD,EACJ,CACF,CAIC,MAAO,CAAE,QAAO,WAAU,SAAQ,eAAc,gBAC9C,EACE,EACA,EACA,EACA,EACA,EACA,EACD,CACJ"}
|
|
@@ -1,40 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
const generateDictionaryListContent = (dictionaries, functionName, importType, format = "esm", configuration = getConfiguration()) => {
|
|
10
|
-
const { mainDir } = configuration.system;
|
|
11
|
-
let content = "";
|
|
12
|
-
const dictionariesRef = dictionaries.map((dictionaryPath) => ({
|
|
13
|
-
relativePath: normalizePath(relative(mainDir, dictionaryPath)),
|
|
14
|
-
id: basename(dictionaryPath, extname(dictionaryPath)),
|
|
15
|
-
hash: `_${getFileHash(dictionaryPath)}`
|
|
16
|
-
}));
|
|
17
|
-
dictionariesRef.forEach((dictionary) => {
|
|
18
|
-
if (format === "esm") content += `import ${dictionary.hash} from '${dictionary.relativePath}'${importType === "json" ? " with { type: 'json' }" : ""};\n`;
|
|
19
|
-
if (format === "cjs") content += `const ${dictionary.hash} = require('${dictionary.relativePath}');\n`;
|
|
20
|
-
});
|
|
21
|
-
content += "\n";
|
|
22
|
-
const formattedDictionaryMap = dictionariesRef.map((dictionary) => ` "${dictionary.id}": ${dictionary.hash}`).join(",\n");
|
|
23
|
-
content += `const dictionaries = {\n${formattedDictionaryMap}\n};\n`;
|
|
24
|
-
content += `const ${functionName} = () => dictionaries;\n`;
|
|
25
|
-
if (format === "esm") {
|
|
26
|
-
content += `\n`;
|
|
27
|
-
content += `export { ${functionName} };\n`;
|
|
28
|
-
content += `export default dictionaries;\n`;
|
|
29
|
-
}
|
|
30
|
-
if (format === "cjs") {
|
|
31
|
-
content += `\n`;
|
|
32
|
-
content += `module.exports.${functionName} = ${functionName};\n`;
|
|
33
|
-
content += `module.exports = dictionaries;\n`;
|
|
34
|
-
}
|
|
35
|
-
return content;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
export { generateDictionaryListContent };
|
|
1
|
+
import{getFileHash as e}from"../utils/getFileHash.mjs";import{getConfiguration as t}from"@intlayer/config/node";import{basename as n,extname as r,relative as i}from"node:path";import{normalizePath as a}from"@intlayer/config/utils";const o=(o,s,c,l=`esm`,u=t())=>{let{mainDir:d}=u.system,f=``,p=o.map(t=>({relativePath:a(i(d,t)),id:n(t,r(t)),hash:`_${e(t)}`}));p.forEach(e=>{l===`esm`&&(f+=`import ${e.hash} from '${e.relativePath}'${c===`json`?` with { type: 'json' }`:``};\n`),l===`cjs`&&(f+=`const ${e.hash} = require('${e.relativePath}');\n`)}),f+=`
|
|
2
|
+
`;let m=p.map(e=>` "${e.id}": ${e.hash}`).join(`,
|
|
3
|
+
`);return f+=`const dictionaries = {\n${m}\n};\n`,f+=`const ${s} = () => dictionaries;\n`,l===`esm`&&(f+=`
|
|
4
|
+
`,f+=`export { ${s} };\n`,f+=`export default dictionaries;
|
|
5
|
+
`),l===`cjs`&&(f+=`
|
|
6
|
+
`,f+=`module.exports.${s} = ${s};\n`,f+=`module.exports = dictionaries;
|
|
7
|
+
`),f};export{o as generateDictionaryListContent};
|
|
40
8
|
//# sourceMappingURL=generateDictionaryListContent.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateDictionaryListContent.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/generateDictionaryListContent.ts"],"sourcesContent":["import { basename, extname, relative } from 'node:path';\nimport { getConfiguration
|
|
1
|
+
{"version":3,"file":"generateDictionaryListContent.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/generateDictionaryListContent.ts"],"sourcesContent":["import { basename, extname, relative } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { normalizePath } from '@intlayer/config/utils';\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 importType: 'json' | 'javascript',\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { mainDir } = configuration.system;\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}'${importType === 'json' ? \" 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":"uOAQA,MAAa,GACX,EACA,EACA,EACA,EAAwB,MACxB,EAAgB,GAAkB,GACvB,CACX,GAAM,CAAE,WAAY,EAAc,OAE9B,EAAU,GAER,EAAkB,EAAa,IAAK,IAAoB,CAC5D,aAAc,EAAc,EAAS,EAAS,EAAe,CAAC,CAC9D,GAAI,EAAS,EAAgB,EAAQ,EAAe,CAAC,CACrD,KAAM,IAAI,EAAY,EAAe,GACtC,EAAE,CAGH,EAAgB,QAAS,GAAe,CAClC,IAAW,QACb,GAAW,UAAU,EAAW,KAAK,SAAS,EAAW,aAAa,GAAG,IAAe,OAAS,yBAA2B,GAAG,MAC7H,IAAW,QACb,GAAW,SAAS,EAAW,KAAK,cAAc,EAAW,aAAa,SAC5E,CAEF,GAAW;EAGX,IAAM,EAAiC,EACpC,IAAK,GAAe,MAAM,EAAW,GAAG,KAAK,EAAW,OAAO,CAC/D,KAAK;EAAM,CAiBd,MAfA,IAAW,2BAA2B,EAAuB,QAC7D,GAAW,SAAS,EAAa,0BAE7B,IAAW,QACb,GAAW;EACX,GAAW,YAAY,EAAa,OACpC,GAAW;GAGT,IAAW,QACb,GAAW;EACX,GAAW,kBAAkB,EAAa,KAAK,EAAa,KAC5D,GAAW;GAGN"}
|
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { basename } from "node:path";
|
|
3
|
-
import { existsSync, mkdirSync } from "node:fs";
|
|
4
|
-
import fg from "fast-glob";
|
|
5
|
-
|
|
6
|
-
//#region src/createDictionaryEntryPoint/getBuiltDictionariesPath.ts
|
|
7
|
-
/**
|
|
8
|
-
* This function generates a list of dictionaries in the main directory
|
|
9
|
-
*/
|
|
10
|
-
const getBuiltDictionariesPath = async (configuration, excludeKeys = []) => {
|
|
11
|
-
const { dictionariesDir, mainDir } = configuration.system;
|
|
12
|
-
if (!existsSync(mainDir)) mkdirSync(mainDir, { recursive: true });
|
|
13
|
-
return (await fg(`${normalizePath(dictionariesDir)}/**/*.json`)).filter((path) => {
|
|
14
|
-
const key = basename(path, ".json");
|
|
15
|
-
return !excludeKeys.includes(key);
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { getBuiltDictionariesPath };
|
|
1
|
+
import{basename as e}from"node:path";import{normalizePath as t}from"@intlayer/config/utils";import{existsSync as n,mkdirSync as r}from"node:fs";import i from"fast-glob";const a=async(a,o=[])=>{let{dictionariesDir:s,mainDir:c}=a.system;return n(c)||r(c,{recursive:!0}),(await i(`${t(s)}/**/*.json`)).filter(t=>{let n=e(t,`.json`);return!o.includes(n)})};export{a as getBuiltDictionariesPath};
|
|
21
2
|
//# sourceMappingURL=getBuiltDictionariesPath.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBuiltDictionariesPath.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { basename } from 'node:path';\nimport { normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltDictionariesPath = async (\n configuration: IntlayerConfig,\n excludeKeys: string[] = []\n) => {\n const { dictionariesDir, mainDir } = configuration.system;\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[] = await fg(\n `${normalizePath(dictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath.filter((path) => {\n const key = basename(path, '.json');\n return !excludeKeys.includes(key);\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBuiltDictionariesPath.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { basename } from 'node:path';\nimport { normalizePath } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltDictionariesPath = async (\n configuration: IntlayerConfig,\n excludeKeys: string[] = []\n) => {\n const { dictionariesDir, mainDir } = configuration.system;\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[] = await fg(\n `${normalizePath(dictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath.filter((path) => {\n const key = basename(path, '.json');\n return !excludeKeys.includes(key);\n });\n};\n"],"mappings":"yKASA,MAAa,EAA2B,MACtC,EACA,EAAwB,EAAE,GACvB,CACH,GAAM,CAAE,kBAAiB,WAAY,EAAc,OAWnD,OARK,EAAW,EAAQ,EACtB,EAAU,EAAS,CAAE,UAAW,GAAM,CAAC,EAGN,MAAM,EACvC,GAAG,EAAc,EAAgB,CAAC,YACnC,EAEuB,OAAQ,GAAS,CACvC,IAAM,EAAM,EAAS,EAAM,QAAQ,CACnC,MAAO,CAAC,EAAY,SAAS,EAAI,EACjC"}
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { basename } from "node:path";
|
|
3
|
-
import { existsSync, mkdirSync } from "node:fs";
|
|
4
|
-
import fg from "fast-glob";
|
|
5
|
-
|
|
6
|
-
//#region src/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.ts
|
|
7
|
-
/**
|
|
8
|
-
* This function generates a list of dictionaries in the main directory
|
|
9
|
-
*/
|
|
10
|
-
const getBuiltDynamicDictionariesPath = async (configuration, format = "esm", excludeKeys = []) => {
|
|
11
|
-
const { dynamicDictionariesDir, mainDir } = configuration.system;
|
|
12
|
-
if (!existsSync(mainDir)) mkdirSync(mainDir, { recursive: true });
|
|
13
|
-
const extension = format === "cjs" ? "cjs" : "mjs";
|
|
14
|
-
return (await fg(`${normalizePath(dynamicDictionariesDir)}/**/*.${extension}`)).filter((path) => {
|
|
15
|
-
const key = basename(path, `.${extension}`);
|
|
16
|
-
return !excludeKeys.includes(key);
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { getBuiltDynamicDictionariesPath };
|
|
1
|
+
import{basename as e}from"node:path";import{normalizePath as t}from"@intlayer/config/utils";import{existsSync as n,mkdirSync as r}from"node:fs";import i from"fast-glob";const a=async(a,o=`esm`,s=[])=>{let{dynamicDictionariesDir:c,mainDir:l}=a.system;n(l)||r(l,{recursive:!0});let u=o===`cjs`?`cjs`:`mjs`;return(await i(`${t(c)}/**/*.${u}`)).filter(t=>{let n=e(t,`.${u}`);return!s.includes(n)})};export{a as getBuiltDynamicDictionariesPath};
|
|
22
2
|
//# sourceMappingURL=getBuiltDynamicDictionariesPath.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBuiltDynamicDictionariesPath.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { basename } from 'node:path';\nimport { normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltDynamicDictionariesPath = async (\n configuration: IntlayerConfig,\n format: 'cjs' | 'esm' = 'esm',\n excludeKeys: string[] = []\n) => {\n const { dynamicDictionariesDir, mainDir } = configuration.system;\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[] = await fg(\n `${normalizePath(dynamicDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath.filter((path) => {\n const key = basename(path, `.${extension}`);\n return !excludeKeys.includes(key);\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBuiltDynamicDictionariesPath.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { basename } from 'node:path';\nimport { normalizePath } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltDynamicDictionariesPath = async (\n configuration: IntlayerConfig,\n format: 'cjs' | 'esm' = 'esm',\n excludeKeys: string[] = []\n) => {\n const { dynamicDictionariesDir, mainDir } = configuration.system;\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[] = await fg(\n `${normalizePath(dynamicDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath.filter((path) => {\n const key = basename(path, `.${extension}`);\n return !excludeKeys.includes(key);\n });\n};\n"],"mappings":"yKASA,MAAa,EAAkC,MAC7C,EACA,EAAwB,MACxB,EAAwB,EAAE,GACvB,CACH,GAAM,CAAE,yBAAwB,WAAY,EAAc,OAGrD,EAAW,EAAQ,EACtB,EAAU,EAAS,CAAE,UAAW,GAAM,CAAC,CAGzC,IAAM,EAAY,IAAW,MAAQ,MAAQ,MAM7C,OAJmC,MAAM,EACvC,GAAG,EAAc,EAAuB,CAAC,QAAQ,IAClD,EAEuB,OAAQ,GAAS,CACvC,IAAM,EAAM,EAAS,EAAM,IAAI,IAAY,CAC3C,MAAO,CAAC,EAAY,SAAS,EAAI,EACjC"}
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { basename } from "node:path";
|
|
3
|
-
import { existsSync, mkdirSync } from "node:fs";
|
|
4
|
-
import fg from "fast-glob";
|
|
5
|
-
|
|
6
|
-
//#region src/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.ts
|
|
7
|
-
/**
|
|
8
|
-
* This function generates a list of dictionaries in the main directory
|
|
9
|
-
*/
|
|
10
|
-
const getBuiltFetchDictionariesPath = async (configuration, format = "esm", excludeKeys = []) => {
|
|
11
|
-
const { fetchDictionariesDir, mainDir } = configuration.system;
|
|
12
|
-
if (!existsSync(mainDir)) mkdirSync(mainDir, { recursive: true });
|
|
13
|
-
const extension = format === "cjs" ? "cjs" : "mjs";
|
|
14
|
-
return (await fg(`${normalizePath(fetchDictionariesDir)}/**/*.${extension}`)).filter((path) => {
|
|
15
|
-
const key = basename(path, `.${extension}`);
|
|
16
|
-
return !excludeKeys.includes(key);
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { getBuiltFetchDictionariesPath };
|
|
1
|
+
import{basename as e}from"node:path";import{normalizePath as t}from"@intlayer/config/utils";import{existsSync as n,mkdirSync as r}from"node:fs";import i from"fast-glob";const a=async(a,o=`esm`,s=[])=>{let{fetchDictionariesDir:c,mainDir:l}=a.system;n(l)||r(l,{recursive:!0});let u=o===`cjs`?`cjs`:`mjs`;return(await i(`${t(c)}/**/*.${u}`)).filter(t=>{let n=e(t,`.${u}`);return!s.includes(n)})};export{a as getBuiltFetchDictionariesPath};
|
|
22
2
|
//# sourceMappingURL=getBuiltFetchDictionariesPath.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBuiltFetchDictionariesPath.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { basename } from 'node:path';\nimport { normalizePath } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltFetchDictionariesPath = async (\n configuration: IntlayerConfig,\n format: 'cjs' | 'esm' = 'esm',\n excludeKeys: string[] = []\n) => {\n const { fetchDictionariesDir, mainDir } = configuration.system;\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[] = await fg(\n `${normalizePath(fetchDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath.filter((path) => {\n const key = basename(path, `.${extension}`);\n return !excludeKeys.includes(key);\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBuiltFetchDictionariesPath.mjs","names":[],"sources":["../../../src/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.ts"],"sourcesContent":["import { existsSync, mkdirSync } from 'node:fs';\nimport { basename } from 'node:path';\nimport { normalizePath } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltFetchDictionariesPath = async (\n configuration: IntlayerConfig,\n format: 'cjs' | 'esm' = 'esm',\n excludeKeys: string[] = []\n) => {\n const { fetchDictionariesDir, mainDir } = configuration.system;\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[] = await fg(\n `${normalizePath(fetchDictionariesDir)}/**/*.${extension}`\n );\n\n return dictionariesPath.filter((path) => {\n const key = basename(path, `.${extension}`);\n return !excludeKeys.includes(key);\n });\n};\n"],"mappings":"yKASA,MAAa,EAAgC,MAC3C,EACA,EAAwB,MACxB,EAAwB,EAAE,GACvB,CACH,GAAM,CAAE,uBAAsB,WAAY,EAAc,OAGnD,EAAW,EAAQ,EACtB,EAAU,EAAS,CAAE,UAAW,GAAM,CAAC,CAGzC,IAAM,EAAY,IAAW,MAAQ,MAAQ,MAM7C,OAJmC,MAAM,EACvC,GAAG,EAAc,EAAqB,CAAC,QAAQ,IAChD,EAEuB,OAAQ,GAAS,CACvC,IAAM,EAAM,EAAS,EAAM,IAAI,IAAY,CAC3C,MAAO,CAAC,EAAY,SAAS,EAAI,EACjC"}
|