@intlayer/chokidar 6.1.6 → 7.0.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{cjs → assets}/getContentDeclarationFileTemplate/cjsTemplate.txt +3 -2
- package/dist/{cjs → assets}/getContentDeclarationFileTemplate/esmTemplate.txt +2 -1
- package/dist/{cjs → assets}/getContentDeclarationFileTemplate/jsonTemplate.txt +2 -1
- package/dist/{cjs → assets}/getContentDeclarationFileTemplate/tsTemplate.txt +2 -1
- package/dist/cjs/_virtual/_utils_asset.cjs +104 -0
- package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +42 -80
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/index.cjs +5 -25
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +21 -42
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +79 -116
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +62 -86
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +48 -69
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +42 -52
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +60 -82
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
- package/dist/cjs/cleanOutputDir.cjs +20 -60
- package/dist/cjs/cleanOutputDir.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +64 -103
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +41 -73
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +19 -49
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +20 -50
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +20 -50
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +19 -49
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +19 -49
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/index.cjs +15 -35
- package/dist/cjs/createType/createModuleAugmentation.cjs +56 -108
- package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
- package/dist/cjs/createType/createType.cjs +29 -58
- package/dist/cjs/createType/createType.cjs.map +1 -1
- package/dist/cjs/createType/index.cjs +7 -25
- package/dist/cjs/fetchDistantDictionaries.cjs +49 -77
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/filterInvalidDictionaries.cjs +26 -59
- package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +32 -68
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +32 -51
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
- package/dist/cjs/handleContentDeclarationFileChange.cjs +35 -56
- package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +36 -0
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -0
- package/dist/cjs/index.cjs +103 -156
- package/dist/cjs/listDictionariesPath.cjs +27 -59
- package/dist/cjs/listDictionariesPath.cjs.map +1 -1
- package/dist/cjs/listGitFiles.cjs +93 -162
- package/dist/cjs/listGitFiles.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +70 -0
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -0
- package/dist/cjs/loadDictionaries/index.cjs +11 -29
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +68 -90
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +111 -166
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +27 -53
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +60 -102
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/log.cjs +107 -182
- package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +73 -130
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/reduceDictionaryContent/applyMask.cjs +27 -61
- package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +10 -32
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
- package/dist/cjs/utils/chunkJSON.cjs +329 -0
- package/dist/cjs/utils/chunkJSON.cjs.map +1 -0
- package/dist/cjs/utils/extractErrorMessage.cjs +92 -135
- package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
- package/dist/cjs/utils/formatter.cjs +19 -49
- package/dist/cjs/utils/formatter.cjs.map +1 -1
- package/dist/cjs/utils/getChunk.cjs +34 -0
- package/dist/cjs/utils/getChunk.cjs.map +1 -0
- package/dist/cjs/utils/getFileHash.cjs +9 -40
- package/dist/cjs/utils/getFileHash.cjs.map +1 -1
- package/dist/cjs/utils/getFormatFromExtension.cjs +23 -54
- package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
- package/dist/cjs/utils/kebabCaseToCamelCase.cjs +11 -36
- package/dist/cjs/utils/kebabCaseToCamelCase.cjs.map +1 -1
- package/dist/cjs/utils/pLimit.cjs +128 -0
- package/dist/cjs/utils/pLimit.cjs.map +1 -0
- package/dist/cjs/utils/parallelize.cjs +10 -169
- package/dist/cjs/utils/parallelize.cjs.map +1 -1
- package/dist/cjs/utils/parallelizeGlobal.cjs +29 -0
- package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -0
- package/dist/cjs/utils/reduceObjectFormat.cjs +31 -0
- package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -0
- package/dist/cjs/utils/resolveObjectPromises.cjs +18 -48
- package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
- package/dist/cjs/utils/runOnce.cjs +80 -57
- package/dist/cjs/utils/runOnce.cjs.map +1 -1
- package/dist/cjs/utils/runParallel.cjs +163 -74
- package/dist/cjs/utils/runParallel.cjs.map +1 -1
- package/dist/cjs/utils/sortAlphabetically.cjs +5 -27
- package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
- package/dist/cjs/utils/splitTextByLine.cjs +11 -0
- package/dist/cjs/utils/splitTextByLine.cjs.map +1 -0
- package/dist/cjs/utils/verifyIdenticObjectFormat copy.cjs +54 -0
- package/dist/cjs/utils/verifyIdenticObjectFormat copy.cjs.map +1 -0
- package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +60 -0
- package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -0
- package/dist/cjs/watcher.cjs +61 -83
- package/dist/cjs/watcher.cjs.map +1 -1
- package/dist/cjs/writeConfiguration/index.cjs +15 -35
- package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +25 -51
- package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs +0 -17
- package/dist/cjs/writeContentDeclaration/index.cjs +9 -33
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +77 -0
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +1731 -755
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +113 -112
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +56 -66
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
- package/dist/cjs/writeFileIfChanged.cjs +10 -43
- package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
- package/dist/cjs/writeJsonIfChanged.cjs +14 -31
- package/dist/cjs/writeJsonIfChanged.cjs.map +1 -1
- package/dist/esm/_virtual/_utils_asset.mjs +100 -0
- package/dist/esm/_virtual/rolldown_runtime.mjs +8 -0
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +35 -54
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/index.mjs +4 -3
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs +18 -17
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +69 -91
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +53 -61
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +40 -42
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +35 -25
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +53 -56
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
- package/dist/esm/cleanOutputDir.mjs +17 -36
- package/dist/esm/cleanOutputDir.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +51 -70
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +36 -47
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +14 -14
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +15 -15
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +15 -15
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +14 -14
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +14 -14
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/index.mjs +9 -8
- package/dist/esm/createType/createModuleAugmentation.mjs +48 -71
- package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
- package/dist/esm/createType/createType.mjs +24 -35
- package/dist/esm/createType/createType.mjs.map +1 -1
- package/dist/esm/createType/index.mjs +4 -3
- package/dist/esm/fetchDistantDictionaries.mjs +45 -52
- package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/filterInvalidDictionaries.mjs +22 -37
- package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +31 -42
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -1
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs +27 -24
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
- package/dist/esm/handleContentDeclarationFileChange.mjs +30 -29
- package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +34 -0
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -0
- package/dist/esm/index.mjs +39 -99
- package/dist/esm/listDictionariesPath.mjs +24 -24
- package/dist/esm/listDictionariesPath.mjs.map +1 -1
- package/dist/esm/listGitFiles.mjs +83 -124
- package/dist/esm/listGitFiles.mjs.map +1 -1
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +66 -0
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -0
- package/dist/esm/loadDictionaries/index.mjs +6 -5
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +61 -70
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +105 -146
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +23 -31
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +52 -74
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/log.mjs +105 -165
- package/dist/esm/loadDictionaries/log.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +64 -97
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/reduceDictionaryContent/applyMask.mjs +26 -37
- package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -1
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +7 -7
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
- package/dist/esm/utils/chunkJSON.mjs +327 -0
- package/dist/esm/utils/chunkJSON.mjs.map +1 -0
- package/dist/esm/utils/extractErrorMessage.mjs +91 -111
- package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
- package/dist/esm/utils/formatter.mjs +10 -12
- package/dist/esm/utils/formatter.mjs.map +1 -1
- package/dist/esm/utils/getChunk.mjs +34 -0
- package/dist/esm/utils/getChunk.mjs.map +1 -0
- package/dist/esm/utils/getFileHash.mjs +6 -5
- package/dist/esm/utils/getFileHash.mjs.map +1 -1
- package/dist/esm/utils/getFormatFromExtension.mjs +21 -29
- package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -1
- package/dist/esm/utils/kebabCaseToCamelCase.mjs +10 -12
- package/dist/esm/utils/kebabCaseToCamelCase.mjs.map +1 -1
- package/dist/esm/utils/pLimit.mjs +126 -0
- package/dist/esm/utils/pLimit.mjs.map +1 -0
- package/dist/esm/utils/parallelize.mjs +10 -144
- package/dist/esm/utils/parallelize.mjs.map +1 -1
- package/dist/esm/utils/parallelizeGlobal.mjs +27 -0
- package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -0
- package/dist/esm/utils/reduceObjectFormat.mjs +30 -0
- package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -0
- package/dist/esm/utils/resolveObjectPromises.mjs +17 -24
- package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -1
- package/dist/esm/utils/runOnce.mjs +76 -33
- package/dist/esm/utils/runOnce.mjs.map +1 -1
- package/dist/esm/utils/runParallel.mjs +160 -40
- package/dist/esm/utils/runParallel.mjs.map +1 -1
- package/dist/esm/utils/sortAlphabetically.mjs +4 -3
- package/dist/esm/utils/sortAlphabetically.mjs.map +1 -1
- package/dist/esm/utils/splitTextByLine.mjs +10 -0
- package/dist/esm/utils/splitTextByLine.mjs.map +1 -0
- package/dist/esm/utils/verifyIdenticObjectFormat copy.mjs +53 -0
- package/dist/esm/utils/verifyIdenticObjectFormat copy.mjs.map +1 -0
- package/dist/esm/utils/verifyIdenticObjectFormat.mjs +59 -0
- package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -0
- package/dist/esm/watcher.mjs +53 -58
- package/dist/esm/watcher.mjs.map +1 -1
- package/dist/esm/writeConfiguration/index.mjs +11 -10
- package/dist/esm/writeConfiguration/index.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs +24 -27
- package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs +0 -1
- package/dist/esm/writeContentDeclaration/index.mjs +6 -7
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +71 -0
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs +1726 -735
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +105 -76
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +48 -46
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
- package/dist/esm/writeFileIfChanged.mjs +7 -18
- package/dist/esm/writeFileIfChanged.mjs.map +1 -1
- package/dist/esm/writeJsonIfChanged.mjs +14 -7
- package/dist/esm/writeJsonIfChanged.mjs.map +1 -1
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +14 -7
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/index.d.ts +3 -3
- package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +7 -2
- package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +14 -10
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +8 -3
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +12 -7
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +8 -2
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +10 -6
- package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -1
- package/dist/types/cleanOutputDir.d.ts +6 -1
- package/dist/types/cleanOutputDir.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +6 -1
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +6 -1
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +7 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +7 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +7 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +7 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +7 -1
- package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/index.d.ts +8 -8
- package/dist/types/createType/createModuleAugmentation.d.ts +8 -5
- package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -1
- package/dist/types/createType/createType.d.ts +7 -4
- package/dist/types/createType/createType.d.ts.map +1 -1
- package/dist/types/createType/index.d.ts +3 -3
- package/dist/types/fetchDistantDictionaries.d.ts +10 -7
- package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/filterInvalidDictionaries.d.ts +7 -4
- package/dist/types/filterInvalidDictionaries.d.ts.map +1 -1
- package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +6 -2
- package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +1 -1
- package/dist/types/handleAdditionalContentDeclarationFile.d.ts +6 -2
- package/dist/types/handleAdditionalContentDeclarationFile.d.ts.map +1 -1
- package/dist/types/handleContentDeclarationFileChange.d.ts +6 -2
- package/dist/types/handleContentDeclarationFileChange.d.ts.map +1 -1
- package/dist/types/handleUnlinkedContentDeclarationFile.d.ts +7 -0
- package/dist/types/handleUnlinkedContentDeclarationFile.d.ts.map +1 -0
- package/dist/types/index.d.ts +49 -33
- package/dist/types/listDictionariesPath.d.ts +7 -2
- package/dist/types/listDictionariesPath.d.ts.map +1 -1
- package/dist/types/listGitFiles.d.ts +24 -12
- package/dist/types/listGitFiles.d.ts.map +1 -1
- package/dist/types/loadDictionaries/getIntlayerBundle.d.ts +11 -0
- package/dist/types/loadDictionaries/getIntlayerBundle.d.ts.map +1 -0
- package/dist/types/loadDictionaries/index.d.ts +5 -5
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +8 -5
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadDictionaries.d.ts +18 -14
- package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +6 -3
- package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +13 -8
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
- package/dist/types/loadDictionaries/log.d.ts +28 -24
- package/dist/types/loadDictionaries/log.d.ts.map +1 -1
- package/dist/types/prepareIntlayer.d.ts +12 -2
- package/dist/types/prepareIntlayer.d.ts.map +1 -1
- package/dist/types/reduceDictionaryContent/applyMask.d.ts +6 -2
- package/dist/types/reduceDictionaryContent/applyMask.d.ts.map +1 -1
- package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +6 -2
- package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts.map +1 -1
- package/dist/types/utils/chunkJSON.d.ts +56 -0
- package/dist/types/utils/chunkJSON.d.ts.map +1 -0
- package/dist/types/utils/extractErrorMessage.d.ts +4 -1
- package/dist/types/utils/extractErrorMessage.d.ts.map +1 -1
- package/dist/types/utils/formatter.d.ts +8 -3
- package/dist/types/utils/formatter.d.ts.map +1 -1
- package/dist/types/utils/getChunk.d.ts +11 -0
- package/dist/types/utils/getChunk.d.ts.map +1 -0
- package/dist/types/utils/getFileHash.d.ts +4 -1
- package/dist/types/utils/getFileHash.d.ts.map +1 -1
- package/dist/types/utils/getFormatFromExtension.d.ts +7 -4
- package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -1
- package/dist/types/utils/kebabCaseToCamelCase.d.ts +4 -1
- package/dist/types/utils/kebabCaseToCamelCase.d.ts.map +1 -1
- package/dist/types/utils/pLimit.d.ts +16 -0
- package/dist/types/utils/pLimit.d.ts.map +1 -0
- package/dist/types/utils/parallelize.d.ts +4 -13
- package/dist/types/utils/parallelize.d.ts.map +1 -1
- package/dist/types/utils/parallelizeGlobal.d.ts +22 -0
- package/dist/types/utils/parallelizeGlobal.d.ts.map +1 -0
- package/dist/types/utils/reduceObjectFormat.d.ts +17 -0
- package/dist/types/utils/reduceObjectFormat.d.ts.map +1 -0
- package/dist/types/utils/resolveObjectPromises.d.ts +4 -1
- package/dist/types/utils/resolveObjectPromises.d.ts.map +1 -1
- package/dist/types/utils/runOnce.d.ts +23 -2
- package/dist/types/utils/runOnce.d.ts.map +1 -1
- package/dist/types/utils/runParallel.d.ts +9 -6
- package/dist/types/utils/runParallel.d.ts.map +1 -1
- package/dist/types/utils/sortAlphabetically.d.ts +4 -1
- package/dist/types/utils/sortAlphabetically.d.ts.map +1 -1
- package/dist/types/utils/splitTextByLine.d.ts +5 -0
- package/dist/types/utils/splitTextByLine.d.ts.map +1 -0
- package/dist/types/utils/verifyIdenticObjectFormat copy.d.ts +23 -0
- package/dist/types/utils/verifyIdenticObjectFormat copy.d.ts.map +1 -0
- package/dist/types/utils/verifyIdenticObjectFormat.d.ts +23 -0
- package/dist/types/utils/verifyIdenticObjectFormat.d.ts.map +1 -0
- package/dist/types/watcher.d.ts +13 -9
- package/dist/types/watcher.d.ts.map +1 -1
- package/dist/types/writeConfiguration/index.d.ts +6 -2
- package/dist/types/writeConfiguration/index.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts +4 -1
- package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +4 -1
- package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/index.d.ts +6 -7
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts +7 -0
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts +33 -6
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +14 -6
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts +7 -3
- package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
- package/dist/types/writeFileIfChanged.d.ts +7 -2
- package/dist/types/writeFileIfChanged.d.ts.map +1 -1
- package/dist/types/writeJsonIfChanged.d.ts +7 -2
- package/dist/types/writeJsonIfChanged.d.ts.map +1 -1
- package/package.json +48 -54
- package/LICENSE +0 -202
- package/dist/cjs/buildIntlayerDictionary/index.cjs.map +0 -1
- package/dist/cjs/createDictionaryEntryPoint/index.cjs.map +0 -1
- package/dist/cjs/createType/index.cjs.map +0 -1
- package/dist/cjs/handleUnlikedContentDeclarationFile.cjs +0 -57
- package/dist/cjs/handleUnlikedContentDeclarationFile.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/loadDictionaries/index.cjs.map +0 -1
- package/dist/cjs/mergeDictionaries.cjs +0 -143
- package/dist/cjs/mergeDictionaries.cjs.map +0 -1
- package/dist/cjs/orderDictionaries.cjs +0 -71
- package/dist/cjs/orderDictionaries.cjs.map +0 -1
- package/dist/cjs/prepareContentDeclaration.cjs +0 -93
- package/dist/cjs/prepareContentDeclaration.cjs.map +0 -1
- package/dist/cjs/processPerLocaleDictionary.cjs +0 -49
- package/dist/cjs/processPerLocaleDictionary.cjs.map +0 -1
- package/dist/cjs/utils/getExtention.cjs +0 -37
- package/dist/cjs/utils/getExtention.cjs.map +0 -1
- package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs.map +0 -1
- package/dist/cjs/writeContentDeclaration/formatCode.cjs +0 -78
- package/dist/cjs/writeContentDeclaration/formatCode.cjs.map +0 -1
- package/dist/cjs/writeContentDeclaration/index.cjs.map +0 -1
- package/dist/esm/buildIntlayerDictionary/index.mjs.map +0 -1
- package/dist/esm/createDictionaryEntryPoint/index.mjs.map +0 -1
- package/dist/esm/createType/index.mjs.map +0 -1
- package/dist/esm/getContentDeclarationFileTemplate/cjsTemplate.txt +0 -9
- package/dist/esm/getContentDeclarationFileTemplate/esmTemplate.txt +0 -9
- package/dist/esm/getContentDeclarationFileTemplate/jsonTemplate.txt +0 -5
- package/dist/esm/getContentDeclarationFileTemplate/tsTemplate.txt +0 -8
- package/dist/esm/handleUnlikedContentDeclarationFile.mjs +0 -33
- package/dist/esm/handleUnlikedContentDeclarationFile.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/loadDictionaries/index.mjs.map +0 -1
- package/dist/esm/mergeDictionaries.mjs +0 -109
- package/dist/esm/mergeDictionaries.mjs.map +0 -1
- package/dist/esm/orderDictionaries.mjs +0 -37
- package/dist/esm/orderDictionaries.mjs.map +0 -1
- package/dist/esm/prepareContentDeclaration.mjs +0 -72
- package/dist/esm/prepareContentDeclaration.mjs.map +0 -1
- package/dist/esm/processPerLocaleDictionary.mjs +0 -25
- package/dist/esm/processPerLocaleDictionary.mjs.map +0 -1
- package/dist/esm/utils/getExtention.mjs +0 -13
- package/dist/esm/utils/getExtention.mjs.map +0 -1
- package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs.map +0 -1
- package/dist/esm/writeContentDeclaration/formatCode.mjs +0 -44
- package/dist/esm/writeContentDeclaration/formatCode.mjs.map +0 -1
- package/dist/esm/writeContentDeclaration/index.mjs.map +0 -1
- package/dist/types/buildIntlayerDictionary/index.d.ts.map +0 -1
- package/dist/types/createDictionaryEntryPoint/index.d.ts.map +0 -1
- package/dist/types/createType/index.d.ts.map +0 -1
- package/dist/types/handleUnlikedContentDeclarationFile.d.ts +0 -3
- package/dist/types/handleUnlikedContentDeclarationFile.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/loadDictionaries/index.d.ts.map +0 -1
- package/dist/types/mergeDictionaries.d.ts +0 -3
- package/dist/types/mergeDictionaries.d.ts.map +0 -1
- package/dist/types/orderDictionaries.d.ts +0 -10
- package/dist/types/orderDictionaries.d.ts.map +0 -1
- package/dist/types/prepareContentDeclaration.d.ts +0 -3
- package/dist/types/prepareContentDeclaration.d.ts.map +0 -1
- package/dist/types/processPerLocaleDictionary.d.ts +0 -32
- package/dist/types/processPerLocaleDictionary.d.ts.map +0 -1
- package/dist/types/utils/getExtention.d.ts +0 -3
- package/dist/types/utils/getExtention.d.ts.map +0 -1
- package/dist/types/writeContentDeclaration/formatCode.d.ts +0 -2
- package/dist/types/writeContentDeclaration/formatCode.d.ts.map +0 -1
- package/dist/types/writeContentDeclaration/index.d.ts.map +0 -1
|
@@ -1,84 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utils_parallelize = require('../utils/parallelize.cjs');
|
|
3
|
+
const require_filterInvalidDictionaries = require('../filterInvalidDictionaries.cjs');
|
|
4
|
+
const require_writeJsonIfChanged = require('../writeJsonIfChanged.cjs');
|
|
5
|
+
let __intlayer_config = require("@intlayer/config");
|
|
6
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
9
|
+
let __intlayer_core = require("@intlayer/core");
|
|
10
|
+
__intlayer_core = require_rolldown_runtime.__toESM(__intlayer_core);
|
|
11
|
+
let node_fs_promises = require("node:fs/promises");
|
|
12
|
+
node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises);
|
|
13
|
+
|
|
14
|
+
//#region src/buildIntlayerDictionary/writeUnmergedDictionary.ts
|
|
15
|
+
const groupDictionariesByKey = (dictionaries) => dictionaries.reduce((acc, dictionary) => {
|
|
16
|
+
const key = dictionary.key;
|
|
17
|
+
if (!acc[key]) acc[key] = [];
|
|
18
|
+
acc[key].push(dictionary);
|
|
19
|
+
return acc;
|
|
20
|
+
}, {});
|
|
21
|
+
/**
|
|
22
|
+
* Write the unmerged dictionaries to the unmergedDictionariesDir
|
|
23
|
+
* @param dictionaries - The dictionaries to write
|
|
24
|
+
* @param configuration - The configuration
|
|
25
|
+
* @returns The grouped dictionaries
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);
|
|
30
|
+
* console.log(unmergedDictionaries);
|
|
31
|
+
*
|
|
32
|
+
* // .intlayer/unmerged_dictionaries/home.json
|
|
33
|
+
* // {
|
|
34
|
+
* // [
|
|
35
|
+
* // { key: 'home', content: { ... } },
|
|
36
|
+
* // { key: 'home', content: { ... } },
|
|
37
|
+
* // ],
|
|
38
|
+
* // }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
const writeUnmergedDictionaries = async (dictionaries, configuration) => {
|
|
42
|
+
const { unmergedDictionariesDir } = configuration.content;
|
|
43
|
+
await (0, node_fs_promises.mkdir)((0, node_path.resolve)(unmergedDictionariesDir), { recursive: true });
|
|
44
|
+
const groupedDictionaries = groupDictionariesByKey(require_filterInvalidDictionaries.filterInvalidDictionaries(dictionaries, configuration));
|
|
45
|
+
const results = await require_utils_parallelize.parallelize(Object.entries(groupedDictionaries), async ([key, dictionaries$1]) => {
|
|
46
|
+
if (key === "undefined") return;
|
|
47
|
+
const orderedDictionaries = (0, __intlayer_core.orderDictionaries)(dictionaries$1, configuration);
|
|
48
|
+
const unmergedFilePath = (0, node_path.resolve)(unmergedDictionariesDir, `${key}.json`);
|
|
49
|
+
await require_writeJsonIfChanged.writeJsonIfChanged(unmergedFilePath, orderedDictionaries).catch((err) => {
|
|
50
|
+
console.error(`${__intlayer_config.x} Error creating unmerged ${(0, __intlayer_config.colorizePath)(unmergedFilePath)}:`, err);
|
|
51
|
+
});
|
|
52
|
+
return [key, {
|
|
53
|
+
dictionaryPath: unmergedFilePath,
|
|
54
|
+
dictionaries: dictionaries$1
|
|
55
|
+
}];
|
|
56
|
+
});
|
|
57
|
+
return Object.fromEntries(results.filter(Boolean));
|
|
9
58
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var writeUnmergedDictionary_exports = {};
|
|
20
|
-
__export(writeUnmergedDictionary_exports, {
|
|
21
|
-
writeUnmergedDictionaries: () => writeUnmergedDictionaries
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(writeUnmergedDictionary_exports);
|
|
24
|
-
var import_config = require("@intlayer/config");
|
|
25
|
-
var import_promises = require("fs/promises");
|
|
26
|
-
var import_path = require("path");
|
|
27
|
-
var import_filterInvalidDictionaries = require('../filterInvalidDictionaries.cjs');
|
|
28
|
-
var import_orderDictionaries = require('../orderDictionaries.cjs');
|
|
29
|
-
var import_parallelize = require('../utils/parallelize.cjs');
|
|
30
|
-
var import_writeJsonIfChanged = require('../writeJsonIfChanged.cjs');
|
|
31
|
-
const groupDictionariesByKey = (dictionaries) => dictionaries.reduce(
|
|
32
|
-
(acc, dictionary) => {
|
|
33
|
-
const key = dictionary.key;
|
|
34
|
-
if (!acc[key]) {
|
|
35
|
-
acc[key] = [];
|
|
36
|
-
}
|
|
37
|
-
acc[key].push(dictionary);
|
|
38
|
-
return acc;
|
|
39
|
-
},
|
|
40
|
-
{}
|
|
41
|
-
);
|
|
42
|
-
const writeUnmergedDictionaries = async (dictionaries, configuration = (0, import_config.getConfiguration)()) => {
|
|
43
|
-
const { unmergedDictionariesDir } = configuration.content;
|
|
44
|
-
await (0, import_promises.mkdir)((0, import_path.resolve)(unmergedDictionariesDir), { recursive: true });
|
|
45
|
-
const filteredDictionaries = (0, import_filterInvalidDictionaries.filterInvalidDictionaries)(dictionaries);
|
|
46
|
-
const groupedDictionaries = groupDictionariesByKey(filteredDictionaries);
|
|
47
|
-
const results = await (0, import_parallelize.parallelize)(
|
|
48
|
-
Object.entries(groupedDictionaries),
|
|
49
|
-
async ([key, dictionaries2]) => {
|
|
50
|
-
if (key === "undefined") {
|
|
51
|
-
return void 0;
|
|
52
|
-
}
|
|
53
|
-
const orderedDictionaries = (0, import_orderDictionaries.orderDictionaries)(
|
|
54
|
-
dictionaries2,
|
|
55
|
-
configuration
|
|
56
|
-
);
|
|
57
|
-
const outputFileName = `${key}.json`;
|
|
58
|
-
const unmergedFilePath = (0, import_path.resolve)(unmergedDictionariesDir, outputFileName);
|
|
59
|
-
await (0, import_writeJsonIfChanged.writeJsonIfChanged)(unmergedFilePath, orderedDictionaries).catch(
|
|
60
|
-
(err) => {
|
|
61
|
-
console.error(
|
|
62
|
-
`${import_config.x} Error creating unmerged ${(0, import_config.colorizePath)(unmergedFilePath)}:`,
|
|
63
|
-
err
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
return [
|
|
68
|
-
key,
|
|
69
|
-
{
|
|
70
|
-
dictionaryPath: unmergedFilePath,
|
|
71
|
-
dictionaries: dictionaries2
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
return Object.fromEntries(
|
|
77
|
-
results.filter(Boolean)
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
-
0 && (module.exports = {
|
|
82
|
-
writeUnmergedDictionaries
|
|
83
|
-
});
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.writeUnmergedDictionaries = writeUnmergedDictionaries;
|
|
84
62
|
//# sourceMappingURL=writeUnmergedDictionary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/buildIntlayerDictionary/writeUnmergedDictionary.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"writeUnmergedDictionary.cjs","names":["filterInvalidDictionaries","parallelize","dictionaries","writeJsonIfChanged","x"],"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 { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { parallelize } from '../utils/parallelize';\nimport { writeJsonIfChanged } from '../writeJsonIfChanged';\n\nconst groupDictionariesByKey = (\n dictionaries: Dictionary[]\n): Record<string, Dictionary[]> =>\n dictionaries.reduce(\n (acc, dictionary) => {\n const key = dictionary.key;\n if (!acc[key]) {\n acc[key] = [];\n }\n acc[key].push(dictionary);\n return acc;\n },\n {} as Record<string, Dictionary[]>\n );\n\nexport type UnmergedDictionaryResult = {\n dictionaryPath: string;\n dictionaries: Dictionary[];\n};\n\nexport type UnmergedDictionaryOutput = Record<string, UnmergedDictionaryResult>;\n\n/**\n * Write the unmerged dictionaries to the unmergedDictionariesDir\n * @param dictionaries - The dictionaries to write\n * @param configuration - The configuration\n * @returns The grouped dictionaries\n *\n * @example\n * ```ts\n * const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);\n * console.log(unmergedDictionaries);\n *\n * // .intlayer/unmerged_dictionaries/home.json\n * // {\n * // [\n * // { key: 'home', content: { ... } },\n * // { key: 'home', content: { ... } },\n * // ],\n * // }\n * ```\n */\nexport const writeUnmergedDictionaries = async (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Promise<UnmergedDictionaryOutput> => {\n const { unmergedDictionariesDir } = configuration.content;\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(unmergedDictionariesDir), { recursive: true });\n\n const filteredDictionaries = filterInvalidDictionaries(\n dictionaries,\n configuration\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\n await writeJsonIfChanged(unmergedFilePath, orderedDictionaries).catch(\n (err) => {\n console.error(\n `${x} Error creating unmerged ${colorizePath(unmergedFilePath)}:`,\n err\n );\n }\n );\n\n return [\n key,\n {\n dictionaryPath: unmergedFilePath,\n dictionaries: dictionaries,\n } as UnmergedDictionaryResult,\n ] as const;\n }\n );\n\n return Object.fromEntries(\n results.filter(Boolean) as Array<\n readonly [string, UnmergedDictionaryResult]\n >\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAM,0BACJ,iBAEA,aAAa,QACV,KAAK,eAAe;CACnB,MAAM,MAAM,WAAW;AACvB,KAAI,CAAC,IAAI,KACP,KAAI,OAAO,EAAE;AAEf,KAAI,KAAK,KAAK,WAAW;AACzB,QAAO;GAET,EAAE,CACH;;;;;;;;;;;;;;;;;;;;;AA6BH,MAAa,4BAA4B,OACvC,cACA,kBACsC;CACtC,MAAM,EAAE,4BAA4B,cAAc;AAGlD,0DAAoB,wBAAwB,EAAE,EAAE,WAAW,MAAM,CAAC;CAQlE,MAAM,sBAAsB,uBANCA,4DAC3B,cACA,cACD,CAGuE;CAExE,MAAM,UAAU,MAAMC,sCACpB,OAAO,QAAQ,oBAAoB,EACnC,OAAO,CAAC,KAAKC,oBAAkB;AAC7B,MAAI,QAAQ,YACV;EAMF,MAAM,6DACJA,gBACA,cACD;EAGD,MAAM,0CAA2B,yBADV,GAAG,IAAI,OAC2C;AAGzE,QAAMC,8CAAmB,kBAAkB,oBAAoB,CAAC,OAC7D,QAAQ;AACP,WAAQ,MACN,GAAGC,oBAAE,+DAAwC,iBAAiB,CAAC,IAC/D,IACD;IAEJ;AAED,SAAO,CACL,KACA;GACE,gBAAgB;GAChB,cAAcF;GACf,CACF;GAEJ;AAED,QAAO,OAAO,YACZ,QAAQ,OAAO,QAAQ,CAGxB"}
|
|
@@ -1,62 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
4
|
+
let __intlayer_config = require("@intlayer/config");
|
|
5
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
6
|
+
|
|
7
|
+
//#region src/cleanOutputDir.ts
|
|
8
|
+
const cleanOutputDir = (configuration) => {
|
|
9
|
+
const { dictionariesDir, unmergedDictionariesDir, dynamicDictionariesDir, mainDir, typesDir, configDir } = configuration.content;
|
|
10
|
+
const appLogger = (0, __intlayer_config.getAppLogger)(configuration);
|
|
11
|
+
if ((0, node_fs.existsSync)(dictionariesDir)) (0, node_fs.rmSync)(dictionariesDir, { recursive: true });
|
|
12
|
+
if ((0, node_fs.existsSync)(unmergedDictionariesDir)) (0, node_fs.rmSync)(unmergedDictionariesDir, { recursive: true });
|
|
13
|
+
if ((0, node_fs.existsSync)(dynamicDictionariesDir)) (0, node_fs.rmSync)(dynamicDictionariesDir, { recursive: true });
|
|
14
|
+
if ((0, node_fs.existsSync)(mainDir)) (0, node_fs.rmSync)(mainDir, { recursive: true });
|
|
15
|
+
if ((0, node_fs.existsSync)(typesDir)) (0, node_fs.rmSync)(typesDir, { recursive: true });
|
|
16
|
+
if ((0, node_fs.existsSync)(configDir)) (0, node_fs.rmSync)(configDir, { recursive: true });
|
|
17
|
+
appLogger("Output directory cleaned", { isVerbose: true });
|
|
9
18
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var cleanOutputDir_exports = {};
|
|
20
|
-
__export(cleanOutputDir_exports, {
|
|
21
|
-
cleanOutputDir: () => cleanOutputDir
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(cleanOutputDir_exports);
|
|
24
|
-
var import_config = require("@intlayer/config");
|
|
25
|
-
var import_fs = require("fs");
|
|
26
|
-
const cleanOutputDir = (configuration = (0, import_config.getConfiguration)()) => {
|
|
27
|
-
const {
|
|
28
|
-
dictionariesDir,
|
|
29
|
-
unmergedDictionariesDir,
|
|
30
|
-
dynamicDictionariesDir,
|
|
31
|
-
mainDir,
|
|
32
|
-
typesDir,
|
|
33
|
-
configDir
|
|
34
|
-
} = configuration.content;
|
|
35
|
-
const appLogger = (0, import_config.getAppLogger)(configuration);
|
|
36
|
-
if ((0, import_fs.existsSync)(dictionariesDir)) {
|
|
37
|
-
(0, import_fs.rmSync)(dictionariesDir, { recursive: true });
|
|
38
|
-
}
|
|
39
|
-
if ((0, import_fs.existsSync)(unmergedDictionariesDir)) {
|
|
40
|
-
(0, import_fs.rmSync)(unmergedDictionariesDir, { recursive: true });
|
|
41
|
-
}
|
|
42
|
-
if ((0, import_fs.existsSync)(dynamicDictionariesDir)) {
|
|
43
|
-
(0, import_fs.rmSync)(dynamicDictionariesDir, { recursive: true });
|
|
44
|
-
}
|
|
45
|
-
if ((0, import_fs.existsSync)(mainDir)) {
|
|
46
|
-
(0, import_fs.rmSync)(mainDir, { recursive: true });
|
|
47
|
-
}
|
|
48
|
-
if ((0, import_fs.existsSync)(typesDir)) {
|
|
49
|
-
(0, import_fs.rmSync)(typesDir, { recursive: true });
|
|
50
|
-
}
|
|
51
|
-
if ((0, import_fs.existsSync)(configDir)) {
|
|
52
|
-
(0, import_fs.rmSync)(configDir, { recursive: true });
|
|
53
|
-
}
|
|
54
|
-
appLogger("Output directory cleaned", {
|
|
55
|
-
isVerbose: true
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
-
0 && (module.exports = {
|
|
60
|
-
cleanOutputDir
|
|
61
|
-
});
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.cleanOutputDir = cleanOutputDir;
|
|
62
22
|
//# sourceMappingURL=cleanOutputDir.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"cleanOutputDir.cjs","names":[],"sources":["../../src/cleanOutputDir.ts"],"sourcesContent":["import { existsSync, rmSync } from 'node:fs';\nimport { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nexport const cleanOutputDir = (configuration: IntlayerConfig) => {\n const {\n dictionariesDir,\n unmergedDictionariesDir,\n dynamicDictionariesDir,\n mainDir,\n typesDir,\n configDir,\n } = configuration.content;\n\n const appLogger = getAppLogger(configuration);\n\n if (existsSync(dictionariesDir)) {\n // Delete the dictionary directory\n rmSync(dictionariesDir, { recursive: true });\n }\n\n if (existsSync(unmergedDictionariesDir)) {\n // Delete the unmerged dictionaries directory\n rmSync(unmergedDictionariesDir, { recursive: true });\n }\n\n if (existsSync(dynamicDictionariesDir)) {\n // Delete the dynamic dictionaries directory\n rmSync(dynamicDictionariesDir, { recursive: true });\n }\n\n // Delete the main directory\n if (existsSync(mainDir)) {\n rmSync(mainDir, { recursive: true });\n }\n\n // Delete the types directory\n if (existsSync(typesDir)) {\n rmSync(typesDir, { recursive: true });\n }\n\n // Delete the config directory\n if (existsSync(configDir)) {\n rmSync(configDir, { recursive: true });\n }\n\n appLogger('Output directory cleaned', {\n isVerbose: true,\n });\n};\n"],"mappings":";;;;;;;AAIA,MAAa,kBAAkB,kBAAkC;CAC/D,MAAM,EACJ,iBACA,yBACA,wBACA,SACA,UACA,cACE,cAAc;CAElB,MAAM,gDAAyB,cAAc;AAE7C,6BAAe,gBAAgB,CAE7B,qBAAO,iBAAiB,EAAE,WAAW,MAAM,CAAC;AAG9C,6BAAe,wBAAwB,CAErC,qBAAO,yBAAyB,EAAE,WAAW,MAAM,CAAC;AAGtD,6BAAe,uBAAuB,CAEpC,qBAAO,wBAAwB,EAAE,WAAW,MAAM,CAAC;AAIrD,6BAAe,QAAQ,CACrB,qBAAO,SAAS,EAAE,WAAW,MAAM,CAAC;AAItC,6BAAe,SAAS,CACtB,qBAAO,UAAU,EAAE,WAAW,MAAM,CAAC;AAIvC,6BAAe,UAAU,CACvB,qBAAO,WAAW,EAAE,WAAW,MAAM,CAAC;AAGxC,WAAU,4BAA4B,EACpC,WAAW,MACZ,CAAC"}
|
|
@@ -1,106 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utils_parallelize = require('../utils/parallelize.cjs');
|
|
3
|
+
const require_writeFileIfChanged = require('../writeFileIfChanged.cjs');
|
|
4
|
+
const require_createDictionaryEntryPoint_generateDictionaryListContent = require('./generateDictionaryListContent.cjs');
|
|
5
|
+
const require_createDictionaryEntryPoint_getBuiltDictionariesPath = require('./getBuiltDictionariesPath.cjs');
|
|
6
|
+
const require_createDictionaryEntryPoint_getBuiltDynamicDictionariesPath = require('./getBuiltDynamicDictionariesPath.cjs');
|
|
7
|
+
const require_createDictionaryEntryPoint_getBuiltFetchDictionariesPath = require('./getBuiltFetchDictionariesPath.cjs');
|
|
8
|
+
const require_createDictionaryEntryPoint_getBuiltRemoteDictionariesPath = require('./getBuiltRemoteDictionariesPath.cjs');
|
|
9
|
+
const require_createDictionaryEntryPoint_getBuiltUnmergedDictionariesPath = require('./getBuiltUnmergedDictionariesPath.cjs');
|
|
10
|
+
let __intlayer_config = require("@intlayer/config");
|
|
11
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
12
|
+
let node_path = require("node:path");
|
|
13
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
14
|
+
let node_fs_promises = require("node:fs/promises");
|
|
15
|
+
node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises);
|
|
16
|
+
|
|
17
|
+
//#region src/createDictionaryEntryPoint/createDictionaryEntryPoint.ts
|
|
18
|
+
const writeDictionaryFiles = async (paths, fileName, functionName, format, configuration = (0, __intlayer_config.getConfiguration)()) => {
|
|
19
|
+
const content = require_createDictionaryEntryPoint_generateDictionaryListContent.generateDictionaryListContent(await paths, functionName, format, configuration);
|
|
20
|
+
const extension = format === "cjs" ? "cjs" : "mjs";
|
|
21
|
+
const { mainDir } = configuration.content;
|
|
22
|
+
await require_writeFileIfChanged.writeFileIfChanged((0, node_path.resolve)(mainDir, `${fileName}.${extension}`), content);
|
|
9
23
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
/**
|
|
25
|
+
* This function generates a list of dictionaries in the main directory
|
|
26
|
+
*/
|
|
27
|
+
const createDictionaryEntryPoint = async (configuration = (0, __intlayer_config.getConfiguration)(), formats) => {
|
|
28
|
+
const outputFormats = formats ?? configuration.build.outputFormat;
|
|
29
|
+
const { mainDir } = configuration.content;
|
|
30
|
+
await (0, node_fs_promises.mkdir)(mainDir, { recursive: true });
|
|
31
|
+
await require_utils_parallelize.parallelize([
|
|
32
|
+
...outputFormats.map((format) => ({
|
|
33
|
+
paths: require_createDictionaryEntryPoint_getBuiltRemoteDictionariesPath.getBuiltRemoteDictionariesPath(configuration),
|
|
34
|
+
functionName: "getRemoteDictionaries",
|
|
35
|
+
fileName: "remote_dictionaries",
|
|
36
|
+
format
|
|
37
|
+
})),
|
|
38
|
+
...outputFormats.map((format) => ({
|
|
39
|
+
paths: require_createDictionaryEntryPoint_getBuiltDictionariesPath.getBuiltDictionariesPath(configuration),
|
|
40
|
+
functionName: "getDictionaries",
|
|
41
|
+
fileName: "dictionaries",
|
|
42
|
+
format
|
|
43
|
+
})),
|
|
44
|
+
...outputFormats.map((format) => ({
|
|
45
|
+
paths: require_createDictionaryEntryPoint_getBuiltUnmergedDictionariesPath.getBuiltUnmergedDictionariesPath(configuration),
|
|
46
|
+
functionName: "getUnmergedDictionaries",
|
|
47
|
+
fileName: "unmerged_dictionaries",
|
|
48
|
+
format
|
|
49
|
+
})),
|
|
50
|
+
...outputFormats.map((format) => ({
|
|
51
|
+
paths: require_createDictionaryEntryPoint_getBuiltDynamicDictionariesPath.getBuiltDynamicDictionariesPath(configuration, format),
|
|
52
|
+
functionName: "getDynamicDictionaries",
|
|
53
|
+
fileName: "dynamic_dictionaries",
|
|
54
|
+
format
|
|
55
|
+
})),
|
|
56
|
+
...outputFormats.map((format) => ({
|
|
57
|
+
paths: require_createDictionaryEntryPoint_getBuiltFetchDictionariesPath.getBuiltFetchDictionariesPath(configuration, format),
|
|
58
|
+
functionName: "getFetchDictionaries",
|
|
59
|
+
fileName: "fetch_dictionaries",
|
|
60
|
+
format
|
|
61
|
+
}))
|
|
62
|
+
], async ({ paths, fileName, format, functionName }) => writeDictionaryFiles(paths, fileName, functionName, format, configuration));
|
|
17
63
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
createDictionaryEntryPoint: () => createDictionaryEntryPoint
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(createDictionaryEntryPoint_exports);
|
|
24
|
-
var import_config = require("@intlayer/config");
|
|
25
|
-
var import_promises = require("fs/promises");
|
|
26
|
-
var import_path = require("path");
|
|
27
|
-
var import_parallelize = require('../utils/parallelize.cjs');
|
|
28
|
-
var import_writeFileIfChanged = require('../writeFileIfChanged.cjs');
|
|
29
|
-
var import_generateDictionaryListContent = require('./generateDictionaryListContent.cjs');
|
|
30
|
-
var import_getBuiltDictionariesPath = require('./getBuiltDictionariesPath.cjs');
|
|
31
|
-
var import_getBuiltDynamicDictionariesPath = require('./getBuiltDynamicDictionariesPath.cjs');
|
|
32
|
-
var import_getBuiltFetchDictionariesPath = require('./getBuiltFetchDictionariesPath.cjs');
|
|
33
|
-
var import_getBuiltRemoteDictionariesPath = require('./getBuiltRemoteDictionariesPath.cjs');
|
|
34
|
-
var import_getBuiltUnmergedDictionariesPath = require('./getBuiltUnmergedDictionariesPath.cjs');
|
|
35
|
-
const filterDictionaries = (paths, keys) => {
|
|
36
|
-
if (!keys) return paths;
|
|
37
|
-
return paths.filter(
|
|
38
|
-
(path) => keys.some((key) => path.endsWith(`${key}.json`))
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
const writeDictionaryFiles = async (paths, fileName, functionName, format, configuration = (0, import_config.getConfiguration)()) => {
|
|
42
|
-
const content = (0, import_generateDictionaryListContent.generateDictionaryListContent)(
|
|
43
|
-
paths,
|
|
44
|
-
functionName,
|
|
45
|
-
format,
|
|
46
|
-
configuration
|
|
47
|
-
);
|
|
48
|
-
const extension = format === "cjs" ? "cjs" : "mjs";
|
|
49
|
-
const { mainDir } = configuration.content;
|
|
50
|
-
await (0, import_writeFileIfChanged.writeFileIfChanged)(
|
|
51
|
-
(0, import_path.resolve)(mainDir, `${fileName}.${extension}`),
|
|
52
|
-
content
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
const createDictionaryEntryPoint = async (configuration = (0, import_config.getConfiguration)(), dictionariesKeys, formats) => {
|
|
56
|
-
const outputFormats = formats ?? configuration.build.outputFormat;
|
|
57
|
-
const { mainDir } = configuration.content;
|
|
58
|
-
await (0, import_promises.mkdir)(mainDir, { recursive: true });
|
|
59
|
-
const remoteDictionariesPath = (0, import_getBuiltRemoteDictionariesPath.getBuiltRemoteDictionariesPath)(configuration);
|
|
60
|
-
const dictionariesPath = filterDictionaries(
|
|
61
|
-
(0, import_getBuiltDictionariesPath.getBuiltDictionariesPath)(configuration),
|
|
62
|
-
dictionariesKeys
|
|
63
|
-
);
|
|
64
|
-
const unmergedDictionariesPath = (0, import_getBuiltUnmergedDictionariesPath.getBuiltUnmergedDictionariesPath)(configuration);
|
|
65
|
-
const writeOperations = [
|
|
66
|
-
...outputFormats.map((format) => ({
|
|
67
|
-
paths: remoteDictionariesPath,
|
|
68
|
-
functionName: "getRemoteDictionaries",
|
|
69
|
-
fileName: "remote_dictionaries",
|
|
70
|
-
format
|
|
71
|
-
})),
|
|
72
|
-
...outputFormats.map((format) => ({
|
|
73
|
-
paths: dictionariesPath,
|
|
74
|
-
functionName: "getDictionaries",
|
|
75
|
-
fileName: "dictionaries",
|
|
76
|
-
format
|
|
77
|
-
})),
|
|
78
|
-
...outputFormats.map((format) => ({
|
|
79
|
-
paths: unmergedDictionariesPath,
|
|
80
|
-
functionName: "getUnmergedDictionaries",
|
|
81
|
-
fileName: "unmerged_dictionaries",
|
|
82
|
-
format
|
|
83
|
-
})),
|
|
84
|
-
...outputFormats.map((format) => ({
|
|
85
|
-
paths: (0, import_getBuiltDynamicDictionariesPath.getBuiltDynamicDictionariesPath)(configuration, format),
|
|
86
|
-
functionName: "getDynamicDictionaries",
|
|
87
|
-
fileName: "dynamic_dictionaries",
|
|
88
|
-
format
|
|
89
|
-
})),
|
|
90
|
-
...outputFormats.map((format) => ({
|
|
91
|
-
paths: (0, import_getBuiltFetchDictionariesPath.getBuiltFetchDictionariesPath)(configuration, format),
|
|
92
|
-
functionName: "getFetchDictionaries",
|
|
93
|
-
fileName: "fetch_dictionaries",
|
|
94
|
-
format
|
|
95
|
-
}))
|
|
96
|
-
];
|
|
97
|
-
await (0, import_parallelize.parallelize)(
|
|
98
|
-
writeOperations,
|
|
99
|
-
async ({ paths, fileName, format, functionName }) => writeDictionaryFiles(paths, fileName, functionName, format, configuration)
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
-
0 && (module.exports = {
|
|
104
|
-
createDictionaryEntryPoint
|
|
105
|
-
});
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
exports.createDictionaryEntryPoint = createDictionaryEntryPoint;
|
|
106
67
|
//# sourceMappingURL=createDictionaryEntryPoint.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/createDictionaryEntryPoint/createDictionaryEntryPoint.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"createDictionaryEntryPoint.cjs","names":["generateDictionaryListContent","writeFileIfChanged","parallelize","getBuiltRemoteDictionariesPath","getBuiltDictionariesPath","getBuiltUnmergedDictionariesPath","getBuiltDynamicDictionariesPath","getBuiltFetchDictionariesPath"],"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 functionName: string,\n format: 'cjs' | 'esm',\n configuration = getConfiguration()\n) => {\n const content = generateDictionaryListContent(\n await paths,\n functionName,\n format,\n configuration\n );\n const extension = format === 'cjs' ? 'cjs' : 'mjs';\n\n const { mainDir } = configuration.content;\n\n await writeFileIfChanged(\n resolve(mainDir, `${fileName}.${extension}`),\n content\n );\n};\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const createDictionaryEntryPoint = async (\n configuration = getConfiguration(),\n formats?: ('cjs' | 'esm')[]\n) => {\n const outputFormats = formats ?? configuration.build.outputFormat;\n const { mainDir } = configuration.content;\n\n await mkdir(mainDir, { recursive: true });\n\n const writeOperations = [\n ...outputFormats.map((format) => ({\n paths: getBuiltRemoteDictionariesPath(configuration),\n functionName: 'getRemoteDictionaries',\n fileName: 'remote_dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: getBuiltDictionariesPath(configuration),\n functionName: 'getDictionaries',\n fileName: 'dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: getBuiltUnmergedDictionariesPath(configuration),\n functionName: 'getUnmergedDictionaries',\n fileName: 'unmerged_dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: getBuiltDynamicDictionariesPath(configuration, format),\n functionName: 'getDynamicDictionaries',\n fileName: 'dynamic_dictionaries' as const,\n format,\n })),\n ...outputFormats.map((format) => ({\n paths: getBuiltFetchDictionariesPath(configuration, format),\n functionName: 'getFetchDictionaries',\n fileName: 'fetch_dictionaries' as const,\n format,\n })),\n ];\n\n await parallelize(\n writeOperations,\n async ({ paths, fileName, format, functionName }) =>\n writeDictionaryFiles(paths, fileName, functionName, format, configuration)\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAM,uBAAuB,OAC3B,OACA,UACA,cACA,QACA,yDAAkC,KAC/B;CACH,MAAM,UAAUA,+FACd,MAAM,OACN,cACA,QACA,cACD;CACD,MAAM,YAAY,WAAW,QAAQ,QAAQ;CAE7C,MAAM,EAAE,YAAY,cAAc;AAElC,OAAMC,qEACI,SAAS,GAAG,SAAS,GAAG,YAAY,EAC5C,QACD;;;;;AAMH,MAAa,6BAA6B,OACxC,yDAAkC,EAClC,YACG;CACH,MAAM,gBAAgB,WAAW,cAAc,MAAM;CACrD,MAAM,EAAE,YAAY,cAAc;AAElC,mCAAY,SAAS,EAAE,WAAW,MAAM,CAAC;AAmCzC,OAAMC,sCAjCkB;EACtB,GAAG,cAAc,KAAK,YAAY;GAChC,OAAOC,iGAA+B,cAAc;GACpD,cAAc;GACd,UAAU;GACV;GACD,EAAE;EACH,GAAG,cAAc,KAAK,YAAY;GAChC,OAAOC,qFAAyB,cAAc;GAC9C,cAAc;GACd,UAAU;GACV;GACD,EAAE;EACH,GAAG,cAAc,KAAK,YAAY;GAChC,OAAOC,qGAAiC,cAAc;GACtD,cAAc;GACd,UAAU;GACV;GACD,EAAE;EACH,GAAG,cAAc,KAAK,YAAY;GAChC,OAAOC,mGAAgC,eAAe,OAAO;GAC7D,cAAc;GACd,UAAU;GACV;GACD,EAAE;EACH,GAAG,cAAc,KAAK,YAAY;GAChC,OAAOC,+FAA8B,eAAe,OAAO;GAC3D,cAAc;GACd,UAAU;GACV;GACD,EAAE;EACJ,EAIC,OAAO,EAAE,OAAO,UAAU,QAAQ,mBAChC,qBAAqB,OAAO,UAAU,cAAc,QAAQ,cAAc,CAC7E"}
|
|
@@ -1,75 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utils_getFileHash = require('../utils/getFileHash.cjs');
|
|
3
|
+
let __intlayer_config = require("@intlayer/config");
|
|
4
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
7
|
+
|
|
8
|
+
//#region src/createDictionaryEntryPoint/generateDictionaryListContent.ts
|
|
9
|
+
/**
|
|
10
|
+
* This function generates the content of the dictionary list file
|
|
11
|
+
*/
|
|
12
|
+
const generateDictionaryListContent = (dictionaries, functionName, format = "esm", configuration = (0, __intlayer_config.getConfiguration)()) => {
|
|
13
|
+
const { mainDir } = configuration.content;
|
|
14
|
+
let content = "";
|
|
15
|
+
const dictionariesRef = dictionaries.map((dictionaryPath) => ({
|
|
16
|
+
relativePath: (0, __intlayer_config.normalizePath)((0, node_path.relative)(mainDir, dictionaryPath)),
|
|
17
|
+
id: (0, node_path.basename)(dictionaryPath, (0, node_path.extname)(dictionaryPath)),
|
|
18
|
+
hash: `_${require_utils_getFileHash.getFileHash(dictionaryPath)}`
|
|
19
|
+
}));
|
|
20
|
+
dictionariesRef.forEach((dictionary) => {
|
|
21
|
+
if (format === "esm") content += `import ${dictionary.hash} from '${dictionary.relativePath}' with { type: 'json' };\n`;
|
|
22
|
+
if (format === "cjs") content += `const ${dictionary.hash} = require('${dictionary.relativePath}');\n`;
|
|
23
|
+
});
|
|
24
|
+
content += "\n";
|
|
25
|
+
const formattedDictionaryMap = dictionariesRef.map((dictionary) => ` "${dictionary.id}": ${dictionary.hash}`).join(",\n");
|
|
26
|
+
content += `const dictionaries = {\n${formattedDictionaryMap}\n};\n`;
|
|
27
|
+
content += `const ${functionName} = () => dictionaries;\n`;
|
|
28
|
+
if (format === "esm") {
|
|
29
|
+
content += `\n`;
|
|
30
|
+
content += `export { ${functionName} };\n`;
|
|
31
|
+
content += `export default dictionaries;\n`;
|
|
32
|
+
}
|
|
33
|
+
if (format === "cjs") {
|
|
34
|
+
content += `\n`;
|
|
35
|
+
content += `module.exports.${functionName} = ${functionName};\n`;
|
|
36
|
+
content += `module.exports = dictionaries;\n`;
|
|
37
|
+
}
|
|
38
|
+
return content;
|
|
9
39
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var generateDictionaryListContent_exports = {};
|
|
20
|
-
__export(generateDictionaryListContent_exports, {
|
|
21
|
-
generateDictionaryListContent: () => generateDictionaryListContent
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(generateDictionaryListContent_exports);
|
|
24
|
-
var import_config = require("@intlayer/config");
|
|
25
|
-
var import_path = require("path");
|
|
26
|
-
var import_getFileHash = require('../utils/getFileHash.cjs');
|
|
27
|
-
const generateDictionaryListContent = (dictionaries, functionName, format = "esm", configuration = (0, import_config.getConfiguration)()) => {
|
|
28
|
-
const { mainDir } = configuration.content;
|
|
29
|
-
let content = "";
|
|
30
|
-
const dictionariesRef = dictionaries.map((dictionaryPath) => ({
|
|
31
|
-
relativePath: (0, import_config.normalizePath)((0, import_path.relative)(mainDir, dictionaryPath)),
|
|
32
|
-
id: (0, import_path.basename)(dictionaryPath, (0, import_path.extname)(dictionaryPath)),
|
|
33
|
-
// Get the base name as the dictionary id
|
|
34
|
-
hash: `_${(0, import_getFileHash.getFileHash)(dictionaryPath)}`
|
|
35
|
-
// Get the hash of the dictionary to avoid conflicts
|
|
36
|
-
}));
|
|
37
|
-
dictionariesRef.forEach((dictionary) => {
|
|
38
|
-
if (format === "esm")
|
|
39
|
-
content += `import ${dictionary.hash} from '${dictionary.relativePath}' with { type: 'json' };
|
|
40
|
-
`;
|
|
41
|
-
if (format === "cjs")
|
|
42
|
-
content += `const ${dictionary.hash} = require('${dictionary.relativePath}');
|
|
43
|
-
`;
|
|
44
|
-
});
|
|
45
|
-
content += "\n";
|
|
46
|
-
const formattedDictionaryMap = dictionariesRef.map((dictionary) => ` "${dictionary.id}": ${dictionary.hash}`).join(",\n");
|
|
47
|
-
content += `const dictionaries = {
|
|
48
|
-
${formattedDictionaryMap}
|
|
49
|
-
};
|
|
50
|
-
`;
|
|
51
|
-
content += `const ${functionName} = () => dictionaries;
|
|
52
|
-
`;
|
|
53
|
-
if (format === "esm") {
|
|
54
|
-
content += `
|
|
55
|
-
`;
|
|
56
|
-
content += `export { ${functionName} };
|
|
57
|
-
`;
|
|
58
|
-
content += `export default dictionaries;
|
|
59
|
-
`;
|
|
60
|
-
}
|
|
61
|
-
if (format === "cjs") {
|
|
62
|
-
content += `
|
|
63
|
-
`;
|
|
64
|
-
content += `module.exports.${functionName} = ${functionName};
|
|
65
|
-
`;
|
|
66
|
-
content += `module.exports = dictionaries;
|
|
67
|
-
`;
|
|
68
|
-
}
|
|
69
|
-
return content;
|
|
70
|
-
};
|
|
71
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
-
0 && (module.exports = {
|
|
73
|
-
generateDictionaryListContent
|
|
74
|
-
});
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.generateDictionaryListContent = generateDictionaryListContent;
|
|
75
43
|
//# sourceMappingURL=generateDictionaryListContent.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/createDictionaryEntryPoint/generateDictionaryListContent.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"generateDictionaryListContent.cjs","names":["getFileHash","formattedDictionaryMap: string"],"sources":["../../../src/createDictionaryEntryPoint/generateDictionaryListContent.ts"],"sourcesContent":["import { basename, extname, relative } from 'node:path';\nimport { getConfiguration, normalizePath } from '@intlayer/config';\nimport { getFileHash } from '../utils/getFileHash';\n\n/**\n * This function generates the content of the dictionary list file\n */\nexport const generateDictionaryListContent = (\n dictionaries: string[],\n functionName: string,\n format: 'cjs' | 'esm' = 'esm',\n configuration = getConfiguration()\n): string => {\n const { mainDir } = configuration.content;\n\n let content = '';\n\n const dictionariesRef = dictionaries.map((dictionaryPath) => ({\n relativePath: normalizePath(relative(mainDir, dictionaryPath)),\n id: basename(dictionaryPath, extname(dictionaryPath)), // Get the base name as the dictionary id\n hash: `_${getFileHash(dictionaryPath)}`, // Get the hash of the dictionary to avoid conflicts\n }));\n\n // Import all dictionaries\n dictionariesRef.forEach((dictionary) => {\n if (format === 'esm')\n content += `import ${dictionary.hash} from '${dictionary.relativePath}' with { type: 'json' };\\n`;\n if (format === 'cjs')\n content += `const ${dictionary.hash} = require('${dictionary.relativePath}');\\n`;\n });\n\n content += '\\n';\n\n // Format Dictionary Map\n const formattedDictionaryMap: string = dictionariesRef\n .map((dictionary) => ` \"${dictionary.id}\": ${dictionary.hash}`)\n .join(',\\n');\n\n content += `const dictionaries = {\\n${formattedDictionaryMap}\\n};\\n`;\n content += `const ${functionName} = () => dictionaries;\\n`;\n\n if (format === 'esm') {\n content += `\\n`;\n content += `export { ${functionName} };\\n`;\n content += `export default dictionaries;\\n`;\n }\n\n if (format === 'cjs') {\n content += `\\n`;\n content += `module.exports.${functionName} = ${functionName};\\n`;\n content += `module.exports = dictionaries;\\n`;\n }\n\n return content;\n};\n"],"mappings":";;;;;;;;;;;AAOA,MAAa,iCACX,cACA,cACA,SAAwB,OACxB,yDAAkC,KACvB;CACX,MAAM,EAAE,YAAY,cAAc;CAElC,IAAI,UAAU;CAEd,MAAM,kBAAkB,aAAa,KAAK,oBAAoB;EAC5D,2EAAqC,SAAS,eAAe,CAAC;EAC9D,4BAAa,uCAAwB,eAAe,CAAC;EACrD,MAAM,IAAIA,sCAAY,eAAe;EACtC,EAAE;AAGH,iBAAgB,SAAS,eAAe;AACtC,MAAI,WAAW,MACb,YAAW,UAAU,WAAW,KAAK,SAAS,WAAW,aAAa;AACxE,MAAI,WAAW,MACb,YAAW,SAAS,WAAW,KAAK,cAAc,WAAW,aAAa;GAC5E;AAEF,YAAW;CAGX,MAAMC,yBAAiC,gBACpC,KAAK,eAAe,MAAM,WAAW,GAAG,KAAK,WAAW,OAAO,CAC/D,KAAK,MAAM;AAEd,YAAW,2BAA2B,uBAAuB;AAC7D,YAAW,SAAS,aAAa;AAEjC,KAAI,WAAW,OAAO;AACpB,aAAW;AACX,aAAW,YAAY,aAAa;AACpC,aAAW;;AAGb,KAAI,WAAW,OAAO;AACpB,aAAW;AACX,aAAW,kBAAkB,aAAa,KAAK,aAAa;AAC5D,aAAW;;AAGb,QAAO"}
|