@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,30 +1,27 @@
|
|
|
1
|
+
//#region src/writeContentDeclaration/detectExportedComponentName.ts
|
|
2
|
+
/**
|
|
3
|
+
* Attempt to detect an exported React component name in the file text.
|
|
4
|
+
* Looks for patterns like:
|
|
5
|
+
* - export const MyComponent = ...
|
|
6
|
+
* - export function MyComponent(...)
|
|
7
|
+
* - export default function MyComponent(...)
|
|
8
|
+
*/
|
|
1
9
|
const detectExportedComponentName = (fileText) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const cjsDefaultMatch = fileText.match(cjsDefaultRegex) || fileText.match(cjsDefaultVarRegex);
|
|
16
|
-
if (cjsDefaultMatch) {
|
|
17
|
-
return cjsDefaultMatch[1];
|
|
18
|
-
}
|
|
19
|
-
let match;
|
|
20
|
-
while ((match = namedExportRegex.exec(fileText)) !== null) {
|
|
21
|
-
if (/^[A-Z]/.test(match[1])) {
|
|
22
|
-
return match[1];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
};
|
|
27
|
-
export {
|
|
28
|
-
detectExportedComponentName
|
|
10
|
+
const defaultEsmFnRegex = /export\s+default\s+function\s+(\w+)/;
|
|
11
|
+
const defaultEsmVarRegex = /export\s+default\s+(\w+)/;
|
|
12
|
+
const cjsDefaultRegex = /module\.exports\s*=\s*(\w+)/;
|
|
13
|
+
const cjsDefaultVarRegex = /exports\.default\s*=\s*(\w+)/;
|
|
14
|
+
const namedExportRegex = /export\s+(?:const|function)\s+(\w+)/g;
|
|
15
|
+
const defaultEsmFnMatch = fileText.match(defaultEsmFnRegex);
|
|
16
|
+
if (defaultEsmFnMatch) return defaultEsmFnMatch[1];
|
|
17
|
+
const defaultEsmVarMatch = fileText.match(defaultEsmVarRegex);
|
|
18
|
+
if (defaultEsmVarMatch) return defaultEsmVarMatch[1];
|
|
19
|
+
const cjsDefaultMatch = fileText.match(cjsDefaultRegex) || fileText.match(cjsDefaultVarRegex);
|
|
20
|
+
if (cjsDefaultMatch) return cjsDefaultMatch[1];
|
|
21
|
+
for (const match of fileText.matchAll(namedExportRegex)) if (/^[A-Z]/.test(match[1])) return match[1];
|
|
22
|
+
return null;
|
|
29
23
|
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { detectExportedComponentName };
|
|
30
27
|
//# sourceMappingURL=detectExportedComponentName.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/writeContentDeclaration/detectExportedComponentName.ts"],"sourcesContent":["/**\n * Attempt to detect an exported React component name in the file text.\n * Looks for patterns like:\n * - export const MyComponent = ...\n * - export function MyComponent(...)\n * - export default function MyComponent(...)\n */\nexport const detectExportedComponentName = (\n fileText: string\n): string | null => {\n // Added regexes for default ESM, default CJS, and named exports\n const defaultEsmFnRegex = /export\\s+default\\s+function\\s+(\\w+)/;\n const defaultEsmVarRegex = /export\\s+default\\s+(\\w+)/;\n const cjsDefaultRegex = /module\\.exports\\s*=\\s*(\\w+)/;\n const cjsDefaultVarRegex = /exports\\.default\\s*=\\s*(\\w+)/;\n const namedExportRegex = /export\\s+(?:const|function)\\s+(\\w+)/g;\n\n // 1) Check for default ESM function or variable\n const defaultEsmFnMatch = fileText.match(defaultEsmFnRegex);\n if (defaultEsmFnMatch) {\n return defaultEsmFnMatch[1];\n }\n\n const defaultEsmVarMatch = fileText.match(defaultEsmVarRegex);\n if (defaultEsmVarMatch) {\n return defaultEsmVarMatch[1];\n }\n\n // 2) Check for default CJS\n const cjsDefaultMatch =\n fileText.match(cjsDefaultRegex) || fileText.match(cjsDefaultVarRegex);\n if (cjsDefaultMatch)
|
|
1
|
+
{"version":3,"file":"detectExportedComponentName.mjs","names":[],"sources":["../../../src/writeContentDeclaration/detectExportedComponentName.ts"],"sourcesContent":["/**\n * Attempt to detect an exported React component name in the file text.\n * Looks for patterns like:\n * - export const MyComponent = ...\n * - export function MyComponent(...)\n * - export default function MyComponent(...)\n */\nexport const detectExportedComponentName = (\n fileText: string\n): string | null => {\n // Added regexes for default ESM, default CJS, and named exports\n const defaultEsmFnRegex = /export\\s+default\\s+function\\s+(\\w+)/;\n const defaultEsmVarRegex = /export\\s+default\\s+(\\w+)/;\n const cjsDefaultRegex = /module\\.exports\\s*=\\s*(\\w+)/;\n const cjsDefaultVarRegex = /exports\\.default\\s*=\\s*(\\w+)/;\n const namedExportRegex = /export\\s+(?:const|function)\\s+(\\w+)/g;\n\n // 1) Check for default ESM function or variable\n const defaultEsmFnMatch = fileText.match(defaultEsmFnRegex);\n if (defaultEsmFnMatch) {\n return defaultEsmFnMatch[1];\n }\n\n const defaultEsmVarMatch = fileText.match(defaultEsmVarRegex);\n if (defaultEsmVarMatch) {\n return defaultEsmVarMatch[1];\n }\n\n // 2) Check for default CJS\n const cjsDefaultMatch =\n fileText.match(cjsDefaultRegex) || fileText.match(cjsDefaultVarRegex);\n\n if (cjsDefaultMatch) return cjsDefaultMatch[1];\n\n // 3) Otherwise, look for capitalized named exports\n for (const match of fileText.matchAll(namedExportRegex)) {\n if (/^[A-Z]/.test(match[1])) return match[1];\n }\n\n // If we can’t find it, return null\n return null;\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,+BACX,aACkB;CAElB,MAAM,oBAAoB;CAC1B,MAAM,qBAAqB;CAC3B,MAAM,kBAAkB;CACxB,MAAM,qBAAqB;CAC3B,MAAM,mBAAmB;CAGzB,MAAM,oBAAoB,SAAS,MAAM,kBAAkB;AAC3D,KAAI,kBACF,QAAO,kBAAkB;CAG3B,MAAM,qBAAqB,SAAS,MAAM,mBAAmB;AAC7D,KAAI,mBACF,QAAO,mBAAmB;CAI5B,MAAM,kBACJ,SAAS,MAAM,gBAAgB,IAAI,SAAS,MAAM,mBAAmB;AAEvE,KAAI,gBAAiB,QAAO,gBAAgB;AAG5C,MAAK,MAAM,SAAS,SAAS,SAAS,iBAAiB,CACrD,KAAI,SAAS,KAAK,MAAM,GAAG,CAAE,QAAO,MAAM;AAI5C,QAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=dictionaryStatus.mjs.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
import { detectExportedComponentName } from "./detectExportedComponentName.mjs";
|
|
2
|
+
import { transformJSFile } from "./transformJSFile.mjs";
|
|
3
|
+
import { writeJSFile } from "./writeJSFile.mjs";
|
|
4
|
+
import { writeContentDeclaration } from "./writeContentDeclaration.mjs";
|
|
5
|
+
|
|
6
|
+
export { detectExportedComponentName, transformJSFile, writeContentDeclaration, writeJSFile };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { colorizePath, x } from "@intlayer/config";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { deepTransformNode } from "@intlayer/core";
|
|
5
|
+
import { NodeType } from "@intlayer/types";
|
|
6
|
+
|
|
7
|
+
//#region src/writeContentDeclaration/processContentDeclarationContent.ts
|
|
8
|
+
/**
|
|
9
|
+
* Write file plugin
|
|
10
|
+
*/
|
|
11
|
+
const writeFilePlugin = {
|
|
12
|
+
id: "write-file-plugin",
|
|
13
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.File,
|
|
14
|
+
transform: (node) => {
|
|
15
|
+
const fileContent = node.content;
|
|
16
|
+
const filePath = node.fixedPath;
|
|
17
|
+
if (typeof fileContent !== "string") throw new Error("File content must be a string");
|
|
18
|
+
if (typeof filePath !== "string") throw new Error("File path must be a string");
|
|
19
|
+
try {
|
|
20
|
+
const absoluteFilePath = join(process.cwd(), filePath);
|
|
21
|
+
const fileDirectory = dirname(absoluteFilePath);
|
|
22
|
+
if (!existsSync(fileDirectory)) mkdirSync(fileDirectory, { recursive: true });
|
|
23
|
+
writeFileSync(absoluteFilePath, fileContent);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
throw new Error(`${x} Error writing file to ${colorizePath(filePath)}: ${error}`);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
nodeType: NodeType.File,
|
|
29
|
+
[NodeType.File]: node.file
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Markdown file plugin
|
|
35
|
+
*/
|
|
36
|
+
const markdownFilePlugin = {
|
|
37
|
+
id: "markdown-file-plugin",
|
|
38
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Markdown,
|
|
39
|
+
transform: (node, props, deepTransformNode$1) => {
|
|
40
|
+
return {
|
|
41
|
+
nodeType: NodeType.Markdown,
|
|
42
|
+
[NodeType.Markdown]: deepTransformNode$1(node.markdown, props)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Insertion file plugin
|
|
48
|
+
*/
|
|
49
|
+
const insertionFilePlugin = {
|
|
50
|
+
id: "insertion-file-plugin",
|
|
51
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Insertion,
|
|
52
|
+
transform: (node, props, deepTransformNode$1) => {
|
|
53
|
+
return {
|
|
54
|
+
nodeType: NodeType.Insertion,
|
|
55
|
+
[NodeType.Insertion]: deepTransformNode$1(node.insertion, props)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const processContentDeclarationContent = async (dictionary) => deepTransformNode(dictionary, {
|
|
60
|
+
dictionaryKey: dictionary.key,
|
|
61
|
+
keyPath: [],
|
|
62
|
+
plugins: [
|
|
63
|
+
writeFilePlugin,
|
|
64
|
+
markdownFilePlugin,
|
|
65
|
+
insertionFilePlugin
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { processContentDeclarationContent };
|
|
71
|
+
//# sourceMappingURL=processContentDeclarationContent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processContentDeclarationContent.mjs","names":["writeFilePlugin: Plugins","markdownFilePlugin: Plugins","deepTransformNode","insertionFilePlugin: Plugins"],"sources":["../../../src/writeContentDeclaration/processContentDeclarationContent.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { colorizePath, x } from '@intlayer/config';\nimport {\n deepTransformNode,\n type FileContent,\n type FileContentConstructor,\n type InsertionContent,\n type InsertionContentConstructor,\n type MarkdownContent,\n type MarkdownContentConstructor,\n type Plugins,\n} from '@intlayer/core';\nimport { type Dictionary, NodeType } from '@intlayer/types';\n\n/**\n * Write file plugin\n */\n\nconst writeFilePlugin: Plugins = {\n id: 'write-file-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.File,\n transform: (node: FileContent) => {\n const fileContent = node.content;\n const filePath = node.fixedPath;\n\n if (typeof fileContent !== 'string') {\n throw new Error('File content must be a string');\n }\n\n if (typeof filePath !== 'string') {\n throw new Error('File path must be a string');\n }\n\n // Write the file to the file system\n try {\n const absoluteFilePath = join(process.cwd(), filePath);\n\n // Create the file directory if it doesn't exist\n const fileDirectory = dirname(absoluteFilePath);\n\n if (!existsSync(fileDirectory)) {\n mkdirSync(fileDirectory, { recursive: true });\n }\n\n // Write the file\n writeFileSync(absoluteFilePath, fileContent);\n } catch (error) {\n throw new Error(\n `${x} Error writing file to ${colorizePath(filePath)}: ${error}`\n );\n }\n\n const transformedFileContent: FileContentConstructor = {\n nodeType: NodeType.File,\n [NodeType.File]: node.file,\n };\n\n return transformedFileContent;\n },\n};\n\n/**\n * Markdown file plugin\n */\n\nconst markdownFilePlugin: Plugins = {\n id: 'markdown-file-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const simplifiedMarkdownNode: MarkdownContentConstructor = {\n nodeType: NodeType.Markdown,\n [NodeType.Markdown]: deepTransformNode(node.markdown, props),\n };\n\n return simplifiedMarkdownNode;\n },\n};\n\n/**\n * Insertion file plugin\n */\n\nconst insertionFilePlugin: Plugins = {\n id: 'insertion-file-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const simplifiedInsertionNode: InsertionContentConstructor = {\n nodeType: NodeType.Insertion,\n [NodeType.Insertion]: deepTransformNode(node.insertion, props),\n };\n\n return simplifiedInsertionNode;\n },\n};\n\nexport const processContentDeclarationContent = async (\n dictionary: Dictionary\n) =>\n deepTransformNode(dictionary, {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [writeFilePlugin, markdownFilePlugin, insertionFilePlugin],\n });\n"],"mappings":";;;;;;;;;;AAmBA,MAAMA,kBAA2B;CAC/B,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,SAAsB;EAChC,MAAM,cAAc,KAAK;EACzB,MAAM,WAAW,KAAK;AAEtB,MAAI,OAAO,gBAAgB,SACzB,OAAM,IAAI,MAAM,gCAAgC;AAGlD,MAAI,OAAO,aAAa,SACtB,OAAM,IAAI,MAAM,6BAA6B;AAI/C,MAAI;GACF,MAAM,mBAAmB,KAAK,QAAQ,KAAK,EAAE,SAAS;GAGtD,MAAM,gBAAgB,QAAQ,iBAAiB;AAE/C,OAAI,CAAC,WAAW,cAAc,CAC5B,WAAU,eAAe,EAAE,WAAW,MAAM,CAAC;AAI/C,iBAAc,kBAAkB,YAAY;WACrC,OAAO;AACd,SAAM,IAAI,MACR,GAAG,EAAE,yBAAyB,aAAa,SAAS,CAAC,IAAI,QAC1D;;AAQH,SALuD;GACrD,UAAU,SAAS;IAClB,SAAS,OAAO,KAAK;GACvB;;CAIJ;;;;AAMD,MAAMC,qBAA8B;CAClC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAAuB,OAAO,wBAAsB;AAM9D,SAL2D;GACzD,UAAU,SAAS;IAClB,SAAS,WAAWC,oBAAkB,KAAK,UAAU,MAAM;GAC7D;;CAIJ;;;;AAMD,MAAMC,sBAA+B;CACnC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAAwB,OAAO,wBAAsB;AAM/D,SAL6D;GAC3D,UAAU,SAAS;IAClB,SAAS,YAAYD,oBAAkB,KAAK,WAAW,MAAM;GAC/D;;CAIJ;AAED,MAAa,mCAAmC,OAC9C,eAEA,kBAAkB,YAAY;CAC5B,eAAe,WAAW;CAC1B,SAAS,EAAE;CACX,SAAS;EAAC;EAAiB;EAAoB;EAAoB;CACpE,CAAC"}
|