@intlayer/chokidar 6.1.6-canary.0 → 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
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./rolldown_runtime.cjs');
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
6
|
+
let node_url = require("node:url");
|
|
7
|
+
node_url = require_rolldown_runtime.__toESM(node_url);
|
|
8
|
+
|
|
9
|
+
//#region \0utils:asset
|
|
10
|
+
const hereDirname = () => {
|
|
11
|
+
try {
|
|
12
|
+
return (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
13
|
+
} catch {
|
|
14
|
+
return typeof __dirname !== "undefined" ? __dirname : process.cwd();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const findDistRoot = (startDir) => {
|
|
18
|
+
let dir = startDir;
|
|
19
|
+
for (let i = 0; i < 12; i++) {
|
|
20
|
+
if ((dir.split("/").pop() || dir.split("\\\\").pop()) === "dist") return dir;
|
|
21
|
+
const parent = (0, node_path.resolve)(dir, "..");
|
|
22
|
+
if (parent === dir) break;
|
|
23
|
+
dir = parent;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
const normalizeFrameFile = (file) => {
|
|
28
|
+
if (!file) return null;
|
|
29
|
+
try {
|
|
30
|
+
if (file.startsWith("file://")) return (0, node_url.fileURLToPath)(file);
|
|
31
|
+
} catch {}
|
|
32
|
+
return file;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Returns the directory of the *caller* module that invoked readAsset.
|
|
36
|
+
* Prefers non-virtual frames; falls back to the first real frame.
|
|
37
|
+
*/
|
|
38
|
+
const getCallerDir = () => {
|
|
39
|
+
const prev = Error.prepareStackTrace;
|
|
40
|
+
try {
|
|
41
|
+
Error.prepareStackTrace = (_, structured) => structured;
|
|
42
|
+
const err = /* @__PURE__ */ new Error();
|
|
43
|
+
Error.captureStackTrace(err, getCallerDir);
|
|
44
|
+
/** @type {import('node:vm').CallSite[]} */
|
|
45
|
+
const frames = err.stack || [];
|
|
46
|
+
const isVirtualPath = (p) => p.includes(`${node_path.sep}_virtual${node_path.sep}`) || p.includes("/_virtual/");
|
|
47
|
+
for (const frame of frames) {
|
|
48
|
+
const file = normalizeFrameFile(typeof frame.getFileName === "function" ? frame.getFileName() : null);
|
|
49
|
+
if (!file) continue;
|
|
50
|
+
if (file.includes("node:internal") || file.includes(`${node_path.sep}internal${node_path.sep}modules${node_path.sep}`)) continue;
|
|
51
|
+
if (!isVirtualPath(file)) return (0, node_path.dirname)(file);
|
|
52
|
+
}
|
|
53
|
+
for (const frame of frames) {
|
|
54
|
+
const file = normalizeFrameFile(typeof frame.getFileName === "function" ? frame.getFileName() : null);
|
|
55
|
+
if (file) return (0, node_path.dirname)(file);
|
|
56
|
+
}
|
|
57
|
+
} catch {} finally {
|
|
58
|
+
Error.prepareStackTrace = prev;
|
|
59
|
+
}
|
|
60
|
+
return hereDirname();
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Read an asset copied from src/** to dist/assets/**.
|
|
64
|
+
* - './' or '../' is resolved relative to the *caller module's* emitted directory.
|
|
65
|
+
* - otherwise, treat as src-relative.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} relPath - e.g. './PROMPT.md' or 'utils/AI/askDocQuestion/embeddings.json'
|
|
68
|
+
* @param {BufferEncoding} [encoding='utf8']
|
|
69
|
+
*/
|
|
70
|
+
const readAsset = (relPath, encoding = "utf8") => {
|
|
71
|
+
const here = hereDirname();
|
|
72
|
+
const distRoot = findDistRoot(here) ?? (0, node_path.resolve)(here, "..", "..", "dist");
|
|
73
|
+
const assetsRoot = (0, node_path.join)(distRoot, "assets");
|
|
74
|
+
const tried = [];
|
|
75
|
+
/**
|
|
76
|
+
* Transform ./dist/esm/my/file.ts to my/file.ts for make resolution easier
|
|
77
|
+
*/
|
|
78
|
+
const callerSubpath = (0, node_path.relative)(distRoot, getCallerDir()).split("\\").join("/").replace(/^esm\//, "").replace(/^cjs\//, "").replace(/^_virtual\//, "");
|
|
79
|
+
if (relPath.startsWith("./") || relPath.startsWith("../")) {
|
|
80
|
+
const fromCallerAbs = (0, node_path.resolve)(assetsRoot, callerSubpath, relPath);
|
|
81
|
+
const fromCallerAbsToVirtual = fromCallerAbs.replace(/^dist\/esm\//, "/dist/assets/").replace(/^dist\/cjs\//, "/dist/assets/");
|
|
82
|
+
tried.push(fromCallerAbsToVirtual);
|
|
83
|
+
if ((0, node_fs.existsSync)(fromCallerAbsToVirtual)) return (0, node_fs.readFileSync)(fromCallerAbsToVirtual, encoding);
|
|
84
|
+
tried.push(fromCallerAbs);
|
|
85
|
+
if ((0, node_fs.existsSync)(fromCallerAbs)) return (0, node_fs.readFileSync)(fromCallerAbs, encoding);
|
|
86
|
+
}
|
|
87
|
+
const directPath = (0, node_path.join)(assetsRoot, relPath);
|
|
88
|
+
tried.push(directPath);
|
|
89
|
+
if ((0, node_fs.existsSync)(directPath)) return (0, node_fs.readFileSync)(directPath, encoding);
|
|
90
|
+
if (callerSubpath) {
|
|
91
|
+
const nested = (0, node_path.join)(assetsRoot, callerSubpath, relPath);
|
|
92
|
+
tried.push(nested);
|
|
93
|
+
if ((0, node_fs.existsSync)(nested)) return (0, node_fs.readFileSync)(nested, encoding);
|
|
94
|
+
}
|
|
95
|
+
const msg = [
|
|
96
|
+
"readAsset: file not found.",
|
|
97
|
+
"Searched:",
|
|
98
|
+
...tried.map((p) => `- ${p}`)
|
|
99
|
+
].join("\n");
|
|
100
|
+
throw new Error(msg);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
exports.readAsset = readAsset;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
exports.__toESM = __toESM;
|
|
@@ -1,82 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_buildIntlayerDictionary_writeDynamicDictionary = require('./writeDynamicDictionary.cjs');
|
|
3
|
+
const require_buildIntlayerDictionary_writeFetchDictionary = require('./writeFetchDictionary.cjs');
|
|
4
|
+
const require_buildIntlayerDictionary_writeMergedDictionary = require('./writeMergedDictionary.cjs');
|
|
5
|
+
const require_buildIntlayerDictionary_writeUnmergedDictionary = require('./writeUnmergedDictionary.cjs');
|
|
6
|
+
let __intlayer_config = require("@intlayer/config");
|
|
7
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
8
|
+
let __intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
|
|
9
|
+
__intlayer_unmerged_dictionaries_entry = require_rolldown_runtime.__toESM(__intlayer_unmerged_dictionaries_entry);
|
|
10
|
+
|
|
11
|
+
//#region src/buildIntlayerDictionary/buildIntlayerDictionary.ts
|
|
12
|
+
/**
|
|
13
|
+
* This function transpile the bundled code to to make dictionaries as JSON files
|
|
14
|
+
*/
|
|
15
|
+
const buildDictionary = async (localDictionariesEntries, configuration = (0, __intlayer_config.getConfiguration)(), formats = ["cjs", "esm"], importOtherDictionaries = true) => {
|
|
16
|
+
const { importMode } = configuration.build;
|
|
17
|
+
const unmergedDictionariesToUpdate = [...localDictionariesEntries];
|
|
18
|
+
if (importOtherDictionaries) {
|
|
19
|
+
const prevUnmergedDictionaries = (0, __intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(configuration);
|
|
20
|
+
for (const dictionaryToWrite of localDictionariesEntries) {
|
|
21
|
+
const allPrebuiltUnmergedDictionaries = prevUnmergedDictionaries[dictionaryToWrite.key];
|
|
22
|
+
if (allPrebuiltUnmergedDictionaries?.length > 0) {
|
|
23
|
+
const otherUnmergedDictionaries = allPrebuiltUnmergedDictionaries.filter((unmergedDictionary) => unmergedDictionary.localId !== dictionaryToWrite.localId);
|
|
24
|
+
unmergedDictionariesToUpdate.push(...otherUnmergedDictionaries);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const unmergedDictionaries = await require_buildIntlayerDictionary_writeUnmergedDictionary.writeUnmergedDictionaries(unmergedDictionariesToUpdate, configuration);
|
|
29
|
+
const mergedDictionaries = await require_buildIntlayerDictionary_writeMergedDictionary.writeMergedDictionaries(unmergedDictionaries, configuration);
|
|
30
|
+
let dynamicDictionaries = null;
|
|
31
|
+
if (importMode === "dynamic" || importMode === "live") dynamicDictionaries = await require_buildIntlayerDictionary_writeDynamicDictionary.writeDynamicDictionary(mergedDictionaries, configuration, formats);
|
|
32
|
+
let fetchDictionaries = null;
|
|
33
|
+
if (importMode === "live") fetchDictionaries = await require_buildIntlayerDictionary_writeFetchDictionary.writeFetchDictionary(dynamicDictionaries, configuration, formats);
|
|
34
|
+
return {
|
|
35
|
+
unmergedDictionaries,
|
|
36
|
+
mergedDictionaries,
|
|
37
|
+
dynamicDictionaries,
|
|
38
|
+
fetchDictionaries
|
|
39
|
+
};
|
|
9
40
|
};
|
|
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 buildIntlayerDictionary_exports = {};
|
|
20
|
-
__export(buildIntlayerDictionary_exports, {
|
|
21
|
-
buildDictionary: () => buildDictionary
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(buildIntlayerDictionary_exports);
|
|
24
|
-
var import_config = require("@intlayer/config");
|
|
25
|
-
var import_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
|
|
26
|
-
var import_writeDynamicDictionary = require('./writeDynamicDictionary.cjs');
|
|
27
|
-
var import_writeFetchDictionary = require('./writeFetchDictionary.cjs');
|
|
28
|
-
var import_writeMergedDictionary = require('./writeMergedDictionary.cjs');
|
|
29
|
-
var import_writeUnmergedDictionary = require('./writeUnmergedDictionary.cjs');
|
|
30
|
-
const buildDictionary = async (localDictionariesEntries, configuration = (0, import_config.getConfiguration)(), formats = ["cjs", "esm"], importOtherDictionaries = true) => {
|
|
31
|
-
const { importMode } = configuration.build;
|
|
32
|
-
let unmergedDictionariesToUpdate = [
|
|
33
|
-
...localDictionariesEntries
|
|
34
|
-
];
|
|
35
|
-
if (importOtherDictionaries) {
|
|
36
|
-
const prevUnmergedDictionaries = (0, import_unmerged_dictionaries_entry.getUnmergedDictionaries)(configuration);
|
|
37
|
-
for (const dictionaryToWrite of localDictionariesEntries) {
|
|
38
|
-
const allPrebuiltUnmergedDictionaries = prevUnmergedDictionaries[dictionaryToWrite.key];
|
|
39
|
-
if (allPrebuiltUnmergedDictionaries?.length > 0) {
|
|
40
|
-
const otherUnmergedDictionaries = allPrebuiltUnmergedDictionaries.filter(
|
|
41
|
-
(unmergedDictionary) => unmergedDictionary.localId !== dictionaryToWrite.localId
|
|
42
|
-
);
|
|
43
|
-
unmergedDictionariesToUpdate.push(...otherUnmergedDictionaries);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const unmergedDictionaries = await (0, import_writeUnmergedDictionary.writeUnmergedDictionaries)(
|
|
48
|
-
unmergedDictionariesToUpdate,
|
|
49
|
-
configuration
|
|
50
|
-
);
|
|
51
|
-
const mergedDictionaries = await (0, import_writeMergedDictionary.writeMergedDictionaries)(
|
|
52
|
-
unmergedDictionaries,
|
|
53
|
-
configuration
|
|
54
|
-
);
|
|
55
|
-
let dynamicDictionaries = null;
|
|
56
|
-
if (importMode === "dynamic" || importMode === "live") {
|
|
57
|
-
dynamicDictionaries = await (0, import_writeDynamicDictionary.writeDynamicDictionary)(
|
|
58
|
-
mergedDictionaries,
|
|
59
|
-
configuration,
|
|
60
|
-
formats
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
let fetchDictionaries = null;
|
|
64
|
-
if (importMode === "live") {
|
|
65
|
-
fetchDictionaries = await (0, import_writeFetchDictionary.writeFetchDictionary)(
|
|
66
|
-
dynamicDictionaries,
|
|
67
|
-
configuration,
|
|
68
|
-
formats
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
unmergedDictionaries,
|
|
73
|
-
mergedDictionaries,
|
|
74
|
-
dynamicDictionaries,
|
|
75
|
-
fetchDictionaries
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
-
0 && (module.exports = {
|
|
80
|
-
buildDictionary
|
|
81
|
-
});
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.buildDictionary = buildDictionary;
|
|
82
44
|
//# sourceMappingURL=buildIntlayerDictionary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/buildIntlayerDictionary/buildIntlayerDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"buildIntlayerDictionary.cjs","names":["unmergedDictionariesToUpdate: Dictionary[]","prevUnmergedDictionaries: Record<string, Dictionary[]>","writeUnmergedDictionaries","writeMergedDictionaries","dynamicDictionaries: LocalizedDictionaryOutput | null","writeDynamicDictionary","fetchDictionaries: LocalizedDictionaryOutput | null","writeFetchDictionary"],"sources":["../../../src/buildIntlayerDictionary/buildIntlayerDictionary.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/types';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport {\n type LocalizedDictionaryOutput,\n writeDynamicDictionary,\n} from './writeDynamicDictionary';\nimport { writeFetchDictionary } from './writeFetchDictionary';\nimport { writeMergedDictionaries } from './writeMergedDictionary';\nimport { writeUnmergedDictionaries } from './writeUnmergedDictionary';\n\n/**\n * This function transpile the bundled code to to make dictionaries as JSON files\n */\nexport const buildDictionary = async (\n localDictionariesEntries: Dictionary[],\n configuration = getConfiguration(),\n formats: ('cjs' | 'esm')[] = ['cjs', 'esm'],\n importOtherDictionaries = true\n) => {\n const { importMode } = configuration.build;\n\n const unmergedDictionariesToUpdate: Dictionary[] = [\n ...localDictionariesEntries,\n ];\n\n if (importOtherDictionaries) {\n const prevUnmergedDictionaries: Record<string, Dictionary[]> =\n getUnmergedDictionaries(configuration);\n\n // Reinsert other dictionaries with the same key to avoid merging errors\n for (const dictionaryToWrite of localDictionariesEntries) {\n const allPrebuiltUnmergedDictionaries =\n prevUnmergedDictionaries[dictionaryToWrite.key];\n\n if (allPrebuiltUnmergedDictionaries?.length > 0) {\n // Do not add the same dictionary again by filtering out the one with the same localId\n const otherUnmergedDictionaries =\n allPrebuiltUnmergedDictionaries.filter(\n (unmergedDictionary) =>\n unmergedDictionary.localId !== dictionaryToWrite.localId\n );\n\n unmergedDictionariesToUpdate.push(...otherUnmergedDictionaries);\n }\n }\n }\n\n const unmergedDictionaries = await writeUnmergedDictionaries(\n unmergedDictionariesToUpdate,\n configuration\n );\n\n const mergedDictionaries = await writeMergedDictionaries(\n unmergedDictionaries,\n configuration\n );\n\n let dynamicDictionaries: LocalizedDictionaryOutput | null = null;\n\n if (importMode === 'dynamic' || importMode === 'live') {\n dynamicDictionaries = await writeDynamicDictionary(\n mergedDictionaries,\n configuration,\n formats\n );\n }\n\n let fetchDictionaries: LocalizedDictionaryOutput | null = null;\n\n if (importMode === 'live') {\n fetchDictionaries = await writeFetchDictionary(\n dynamicDictionaries!,\n configuration,\n formats\n );\n }\n\n return {\n unmergedDictionaries,\n mergedDictionaries,\n dynamicDictionaries,\n fetchDictionaries,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,kBAAkB,OAC7B,0BACA,yDAAkC,EAClC,UAA6B,CAAC,OAAO,MAAM,EAC3C,0BAA0B,SACvB;CACH,MAAM,EAAE,eAAe,cAAc;CAErC,MAAMA,+BAA6C,CACjD,GAAG,yBACJ;AAED,KAAI,yBAAyB;EAC3B,MAAMC,+FACoB,cAAc;AAGxC,OAAK,MAAM,qBAAqB,0BAA0B;GACxD,MAAM,kCACJ,yBAAyB,kBAAkB;AAE7C,OAAI,iCAAiC,SAAS,GAAG;IAE/C,MAAM,4BACJ,gCAAgC,QAC7B,uBACC,mBAAmB,YAAY,kBAAkB,QACpD;AAEH,iCAA6B,KAAK,GAAG,0BAA0B;;;;CAKrE,MAAM,uBAAuB,MAAMC,kFACjC,8BACA,cACD;CAED,MAAM,qBAAqB,MAAMC,8EAC/B,sBACA,cACD;CAED,IAAIC,sBAAwD;AAE5D,KAAI,eAAe,aAAa,eAAe,OAC7C,uBAAsB,MAAMC,8EAC1B,oBACA,eACA,QACD;CAGH,IAAIC,oBAAsD;AAE1D,KAAI,eAAe,OACjB,qBAAoB,MAAMC,0EACxB,qBACA,eACA,QACD;AAGH,QAAO;EACL;EACA;EACA;EACA;EACD"}
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var buildIntlayerDictionary_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(buildIntlayerDictionary_exports);
|
|
18
|
-
__reExport(buildIntlayerDictionary_exports, require('./buildIntlayerDictionary.cjs'), module.exports);
|
|
19
|
-
__reExport(buildIntlayerDictionary_exports, require('./processContentDeclaration.cjs'), module.exports);
|
|
20
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
-
0 && (module.exports = {
|
|
22
|
-
...require('./buildIntlayerDictionary.cjs'),
|
|
23
|
-
...require('./processContentDeclaration.cjs')
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
const require_buildIntlayerDictionary_buildIntlayerDictionary = require('./buildIntlayerDictionary.cjs');
|
|
2
|
+
const require_buildIntlayerDictionary_processContentDeclaration = require('./processContentDeclaration.cjs');
|
|
3
|
+
|
|
4
|
+
exports.buildDictionary = require_buildIntlayerDictionary_buildIntlayerDictionary.buildDictionary;
|
|
5
|
+
exports.processContentDeclaration = require_buildIntlayerDictionary_processContentDeclaration.processContentDeclaration;
|
|
@@ -1,45 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var processContentDeclaration_exports = {};
|
|
20
|
-
__export(processContentDeclaration_exports, {
|
|
21
|
-
processContentDeclaration: () => processContentDeclaration
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(processContentDeclaration_exports);
|
|
24
|
-
var import_client = require("@intlayer/config/client");
|
|
25
|
-
var import_resolveObjectPromises = require('../utils/resolveObjectPromises.cjs');
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utils_resolveObjectPromises = require('../utils/resolveObjectPromises.cjs');
|
|
3
|
+
let __intlayer_config_client = require("@intlayer/config/client");
|
|
4
|
+
__intlayer_config_client = require_rolldown_runtime.__toESM(__intlayer_config_client);
|
|
5
|
+
|
|
6
|
+
//#region src/buildIntlayerDictionary/processContentDeclaration.ts
|
|
7
|
+
/**
|
|
8
|
+
* Function to load, process the module and return the Intlayer Dictionary from the module file
|
|
9
|
+
*/
|
|
26
10
|
const processContentDeclaration = async (contentDeclaration) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
(0, import_client.logger)(error, {
|
|
37
|
-
level: "error"
|
|
38
|
-
});
|
|
39
|
-
}
|
|
11
|
+
try {
|
|
12
|
+
const content = await require_utils_resolveObjectPromises.resolveObjectPromises(contentDeclaration.content);
|
|
13
|
+
return {
|
|
14
|
+
...contentDeclaration,
|
|
15
|
+
content
|
|
16
|
+
};
|
|
17
|
+
} catch (error) {
|
|
18
|
+
(0, __intlayer_config_client.logger)(error, { level: "error" });
|
|
19
|
+
}
|
|
40
20
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.processContentDeclaration = processContentDeclaration;
|
|
45
24
|
//# sourceMappingURL=processContentDeclaration.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/buildIntlayerDictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"processContentDeclaration.cjs","names":["resolveObjectPromises"],"sources":["../../../src/buildIntlayerDictionary/processContentDeclaration.ts"],"sourcesContent":["import { logger } from '@intlayer/config/client';\nimport type { Dictionary } from '@intlayer/types';\nimport { resolveObjectPromises } from '../utils/resolveObjectPromises';\n\n/**\n * Function to load, process the module and return the Intlayer Dictionary from the module file\n */\nexport const processContentDeclaration = async (\n contentDeclaration: Dictionary\n): Promise<Dictionary | undefined> => {\n try {\n const content = (await resolveObjectPromises(\n contentDeclaration.content\n )) as Dictionary['content'];\n\n return {\n ...contentDeclaration,\n content,\n } as Dictionary;\n } catch (error) {\n logger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":";;;;;;;;;AAOA,MAAa,4BAA4B,OACvC,uBACoC;AACpC,KAAI;EACF,MAAM,UAAW,MAAMA,0DACrB,mBAAmB,QACpB;AAED,SAAO;GACL,GAAG;GACH;GACD;UACM,OAAO;AACd,uCAAO,OAAO,EACZ,OAAO,SACR,CAAC"}
|
|
@@ -1,119 +1,82 @@
|
|
|
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_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/writeDynamicDictionary.ts
|
|
15
|
+
/**
|
|
16
|
+
* This function generates the content of the dictionary list file
|
|
17
|
+
*/
|
|
18
|
+
const generateDictionaryEntryPoint = (localizedDictionariesPathsRecord, format = "esm", configuration = (0, __intlayer_config.getConfiguration)()) => {
|
|
19
|
+
const { dynamicDictionariesDir } = configuration.content;
|
|
20
|
+
let content = "";
|
|
21
|
+
const formattedDictionaryMap = Object.entries(localizedDictionariesPathsRecord).filter((entry) => Boolean(entry[1])).sort(([a], [b]) => String(a).localeCompare(String(b))).map(([locale, dictionary]) => {
|
|
22
|
+
const relativePath = (0, __intlayer_config.normalizePath)((0, node_path.relative)(dynamicDictionariesDir, dictionary.dictionaryPath));
|
|
23
|
+
if (format === "esm") return ` '${locale}': () => import('./${relativePath}', { assert: { type: 'json' }}).then(mod => mod.default)`;
|
|
24
|
+
return ` '${locale}': () => Promise.resolve(require('./${relativePath}'))`;
|
|
25
|
+
}).join(",\n");
|
|
26
|
+
content += `const content = {\n${formattedDictionaryMap}\n};\n`;
|
|
27
|
+
if (format === "esm") content += `export default content;\n`;
|
|
28
|
+
if (format === "cjs") content += `module.exports = content;\n`;
|
|
29
|
+
return content;
|
|
9
30
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Write the localized dictionaries to the dictionariesDir
|
|
33
|
+
* @param mergedDictionaries - The merged dictionaries
|
|
34
|
+
* @param configuration - The configuration
|
|
35
|
+
* @returns The final dictionaries
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const unmergedDictionaries = await writeUnmergedDictionaries(dictionaries);
|
|
40
|
+
* const finalDictionaries = await writeFinalDictionaries(unmergedDictionaries);
|
|
41
|
+
* console.log(finalDictionaries);
|
|
42
|
+
*
|
|
43
|
+
* // .intlayer/dynamic_dictionaries/home.json
|
|
44
|
+
* // { key: 'home', content: { ... } },
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
const writeDynamicDictionary = async (mergedDictionaries, configuration = (0, __intlayer_config.getConfiguration)(), formats = ["cjs", "esm"]) => {
|
|
48
|
+
const { locales, defaultLocale } = configuration.internationalization;
|
|
49
|
+
const { dynamicDictionariesDir } = configuration.content;
|
|
50
|
+
await (0, node_fs_promises.mkdir)((0, node_path.resolve)(dynamicDictionariesDir), { recursive: true });
|
|
51
|
+
const resultDictionariesPaths = {};
|
|
52
|
+
await require_utils_parallelize.parallelize(Object.entries(mergedDictionaries).sort(([a], [b]) => String(a).localeCompare(String(b))), async ([key, dictionaryEntry]) => {
|
|
53
|
+
if (key === "undefined") return;
|
|
54
|
+
const localizedDictionariesPathsRecord = {};
|
|
55
|
+
await require_utils_parallelize.parallelize(locales, async (locale) => {
|
|
56
|
+
const localizedDictionary = (0, __intlayer_core.getPerLocaleDictionary)(dictionaryEntry.dictionary, locale, defaultLocale);
|
|
57
|
+
const outputFileName = `${key}.${locale}.json`;
|
|
58
|
+
const resultFilePath = (0, node_path.resolve)(dynamicDictionariesDir, outputFileName);
|
|
59
|
+
await require_writeJsonIfChanged.writeJsonIfChanged(resultFilePath, localizedDictionary).catch((err) => {
|
|
60
|
+
console.error(`Error creating localized ${outputFileName}:`, err);
|
|
61
|
+
});
|
|
62
|
+
localizedDictionariesPathsRecord[locale] = {
|
|
63
|
+
dictionaryPath: resultFilePath,
|
|
64
|
+
dictionary: localizedDictionary
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
resultDictionariesPaths[key] = localizedDictionariesPathsRecord;
|
|
68
|
+
await require_utils_parallelize.parallelize(formats, async (format) => {
|
|
69
|
+
const extension = format === "cjs" ? "cjs" : "mjs";
|
|
70
|
+
const content = generateDictionaryEntryPoint(localizedDictionariesPathsRecord, format, configuration);
|
|
71
|
+
await require_writeFileIfChanged.writeFileIfChanged((0, node_path.resolve)(dynamicDictionariesDir, `${key}.${extension}`), content).catch((err) => {
|
|
72
|
+
console.error(`Error creating dynamic ${(0, __intlayer_config.colorizePath)((0, node_path.resolve)(dynamicDictionariesDir, `${key}.${extension}`))}:`, err);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
return resultDictionariesPaths;
|
|
17
77
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
writeDynamicDictionary: () => writeDynamicDictionary
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(writeDynamicDictionary_exports);
|
|
25
|
-
var import_config = require("@intlayer/config");
|
|
26
|
-
var import_core = require("@intlayer/core");
|
|
27
|
-
var import_promises = require("fs/promises");
|
|
28
|
-
var import_path = require("path");
|
|
29
|
-
var import_parallelize = require('../utils/parallelize.cjs');
|
|
30
|
-
var import_writeFileIfChanged = require('../writeFileIfChanged.cjs');
|
|
31
|
-
var import_writeJsonIfChanged = require('../writeJsonIfChanged.cjs');
|
|
32
|
-
const generateDictionaryEntryPoint = (localedDictionariesPathsRecord, format = "esm", configuration = (0, import_config.getConfiguration)()) => {
|
|
33
|
-
const { dynamicDictionariesDir } = configuration.content;
|
|
34
|
-
let content = "";
|
|
35
|
-
const formattedDictionaryMap = Object.entries(
|
|
36
|
-
localedDictionariesPathsRecord
|
|
37
|
-
).filter((entry) => Boolean(entry[1])).sort(([a], [b]) => String(a).localeCompare(String(b))).map(([locale, dictionary]) => {
|
|
38
|
-
const relativePath = (0, import_config.normalizePath)(
|
|
39
|
-
(0, import_path.relative)(dynamicDictionariesDir, dictionary.dictionaryPath)
|
|
40
|
-
);
|
|
41
|
-
if (format === "esm") {
|
|
42
|
-
return ` '${locale}': () => import('./${relativePath}', { assert: { type: 'json' }}).then(mod => mod.default)`;
|
|
43
|
-
}
|
|
44
|
-
return ` '${locale}': () => Promise.resolve(require('./${relativePath}.cjs'))`;
|
|
45
|
-
}).join(",\n");
|
|
46
|
-
content += `const content = {
|
|
47
|
-
${formattedDictionaryMap}
|
|
48
|
-
};
|
|
49
|
-
`;
|
|
50
|
-
if (format === "esm") content += `export default content;
|
|
51
|
-
`;
|
|
52
|
-
if (format === "cjs") content += `module.exports = content;
|
|
53
|
-
`;
|
|
54
|
-
return content;
|
|
55
|
-
};
|
|
56
|
-
const writeDynamicDictionary = async (mergedDictionaries, configuration = (0, import_config.getConfiguration)(), formats = ["cjs", "esm"]) => {
|
|
57
|
-
const { locales, defaultLocale } = configuration.internationalization;
|
|
58
|
-
const { dynamicDictionariesDir } = configuration.content;
|
|
59
|
-
await (0, import_promises.mkdir)((0, import_path.resolve)(dynamicDictionariesDir), { recursive: true });
|
|
60
|
-
let resultDictionariesPaths = {};
|
|
61
|
-
await (0, import_parallelize.parallelize)(
|
|
62
|
-
Object.entries(mergedDictionaries).sort(
|
|
63
|
-
([a], [b]) => String(a).localeCompare(String(b))
|
|
64
|
-
),
|
|
65
|
-
async ([key, dictionaryEntry]) => {
|
|
66
|
-
if (key === "undefined") return;
|
|
67
|
-
let localedDictionariesPathsRecord = {};
|
|
68
|
-
await (0, import_parallelize.parallelize)(locales, async (locale) => {
|
|
69
|
-
const localizedDictionary = {
|
|
70
|
-
...dictionaryEntry.dictionary,
|
|
71
|
-
locale,
|
|
72
|
-
// @ts-ignore Type instantiation is excessively deep and possibly infinite
|
|
73
|
-
content: (0, import_core.getLocalisedContent)(
|
|
74
|
-
JSON.parse(JSON.stringify(dictionaryEntry.dictionary.content)),
|
|
75
|
-
locale,
|
|
76
|
-
{ dictionaryKey: key, keyPath: [] },
|
|
77
|
-
defaultLocale
|
|
78
|
-
)
|
|
79
|
-
};
|
|
80
|
-
const outputFileName = `${key}.${locale}.json`;
|
|
81
|
-
const resultFilePath = (0, import_path.resolve)(dynamicDictionariesDir, outputFileName);
|
|
82
|
-
await (0, import_writeJsonIfChanged.writeJsonIfChanged)(resultFilePath, localizedDictionary).catch(
|
|
83
|
-
(err) => {
|
|
84
|
-
console.error(`Error creating localized ${outputFileName}:`, err);
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
localedDictionariesPathsRecord[locale] = {
|
|
88
|
-
dictionaryPath: resultFilePath,
|
|
89
|
-
dictionary: localizedDictionary
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
resultDictionariesPaths[key] = localedDictionariesPathsRecord;
|
|
93
|
-
await (0, import_parallelize.parallelize)(formats, async (format) => {
|
|
94
|
-
const extension = format === "cjs" ? "cjs" : "mjs";
|
|
95
|
-
const content = generateDictionaryEntryPoint(
|
|
96
|
-
localedDictionariesPathsRecord,
|
|
97
|
-
format,
|
|
98
|
-
configuration
|
|
99
|
-
);
|
|
100
|
-
await (0, import_writeFileIfChanged.writeFileIfChanged)(
|
|
101
|
-
(0, import_path.resolve)(dynamicDictionariesDir, `${key}.${extension}`),
|
|
102
|
-
content
|
|
103
|
-
).catch((err) => {
|
|
104
|
-
console.error(
|
|
105
|
-
`Error creating dynamic ${(0, import_config.colorizePath)((0, import_path.resolve)(dynamicDictionariesDir, `${key}.${extension}`))}:`,
|
|
106
|
-
err
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
return resultDictionariesPaths;
|
|
113
|
-
};
|
|
114
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
115
|
-
0 && (module.exports = {
|
|
116
|
-
generateDictionaryEntryPoint,
|
|
117
|
-
writeDynamicDictionary
|
|
118
|
-
});
|
|
78
|
+
|
|
79
|
+
//#endregion
|
|
80
|
+
exports.generateDictionaryEntryPoint = generateDictionaryEntryPoint;
|
|
81
|
+
exports.writeDynamicDictionary = writeDynamicDictionary;
|
|
119
82
|
//# sourceMappingURL=writeDynamicDictionary.cjs.map
|