@intlayer/chokidar 8.1.2 → 8.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/installSkills/skills/angular.md +3 -0
- package/dist/assets/installSkills/skills/astro.md +3 -0
- package/dist/assets/installSkills/skills/cli.md +7 -4
- package/dist/assets/installSkills/skills/config.md +3 -0
- package/dist/assets/installSkills/skills/content.md +3 -0
- package/dist/assets/installSkills/skills/next_js.md +3 -0
- package/dist/assets/installSkills/skills/preact.md +3 -2
- package/dist/assets/installSkills/skills/react.md +3 -0
- package/dist/assets/installSkills/skills/solid.md +3 -0
- package/dist/assets/installSkills/skills/svelte.md +3 -0
- package/dist/assets/installSkills/skills/usage.md +2 -0
- package/dist/assets/installSkills/skills/vue.md +3 -0
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/cjs/_virtual/_utils_asset.cjs +2 -98
- package/dist/cjs/build.cjs +1 -51
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +1 -53
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/index.cjs +1 -6
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +1 -26
- package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +4 -78
- package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +4 -62
- package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -46
- package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +1 -50
- package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +1 -59
- package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
- package/dist/cjs/cleanOutputDir.cjs +1 -30
- package/dist/cjs/cleanOutputDir.cjs.map +1 -1
- package/dist/cjs/cleanRemovedContentDeclaration.cjs +1 -96
- package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
- package/dist/cjs/cli.cjs +1 -21
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -70
- package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +7 -41
- package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +1 -23
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +1 -24
- package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +1 -24
- package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +1 -23
- package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +1 -23
- package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
- package/dist/cjs/createDictionaryEntryPoint/index.cjs +1 -16
- package/dist/cjs/createType/createModuleAugmentation.cjs +9 -110
- package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
- package/dist/cjs/createType/createType.cjs +1 -29
- package/dist/cjs/createType/createType.cjs.map +1 -1
- package/dist/cjs/createType/index.cjs +1 -8
- package/dist/cjs/fetchDistantDictionaries.cjs +1 -50
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/filterInvalidDictionaries.cjs +1 -49
- package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
- package/dist/cjs/formatDictionary.cjs +1 -49
- package/dist/cjs/formatDictionary.cjs.map +1 -1
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +1 -39
- package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +1 -34
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
- package/dist/cjs/handleContentDeclarationFileChange.cjs +1 -49
- package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
- package/dist/cjs/handleContentDeclarationFileMoved.cjs +1 -24
- package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +1 -37
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -131
- package/dist/cjs/init/index.cjs +1 -242
- package/dist/cjs/init/index.cjs.map +1 -1
- package/dist/cjs/init/utils/configManipulation.cjs +1 -164
- package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
- package/dist/cjs/init/utils/fileSystem.cjs +1 -30
- package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
- package/dist/cjs/init/utils/index.cjs +1 -13
- package/dist/cjs/init/utils/jsonParser.cjs +3 -42
- package/dist/cjs/init/utils/jsonParser.cjs.map +1 -1
- package/dist/cjs/init/utils/tsConfig.cjs +1 -18
- package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
- package/dist/cjs/initConfig/index.cjs +1 -38
- package/dist/cjs/initConfig/index.cjs.map +1 -1
- package/dist/cjs/installSkills/index.cjs +1 -172
- package/dist/cjs/installSkills/index.cjs.map +1 -1
- package/dist/cjs/listDictionariesPath.cjs +1 -41
- package/dist/cjs/listDictionariesPath.cjs.map +1 -1
- package/dist/cjs/listGitFiles.cjs +5 -95
- package/dist/cjs/listGitFiles.cjs.map +1 -1
- package/dist/cjs/listProjects.cjs +1 -47
- package/dist/cjs/listProjects.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -66
- package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/index.cjs +1 -12
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +2 -72
- package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -125
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +1 -28
- package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +1 -61
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/log.cjs +3 -135
- package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +1 -95
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/reduceDictionaryContent/applyMask.cjs +1 -30
- package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +1 -12
- package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
- package/dist/cjs/transformFiles/extractDictionaryKey.cjs +1 -16
- package/dist/cjs/transformFiles/extractDictionaryKey.cjs.map +1 -1
- package/dist/cjs/transformFiles/index.cjs +1 -10
- package/dist/cjs/transformFiles/transformFiles.cjs +1 -251
- package/dist/cjs/transformFiles/transformFiles.cjs.map +1 -1
- package/dist/cjs/utils/autoDecorateContent.cjs +1 -87
- package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -1
- package/dist/cjs/utils/buildFilesList.cjs +1 -50
- package/dist/cjs/utils/buildFilesList.cjs.map +1 -1
- package/dist/cjs/utils/chunkJSON.cjs +1 -336
- package/dist/cjs/utils/chunkJSON.cjs.map +1 -1
- package/dist/cjs/utils/formatter.cjs +1 -16
- package/dist/cjs/utils/formatter.cjs.map +1 -1
- package/dist/cjs/utils/getChunk.cjs +1 -34
- package/dist/cjs/utils/getChunk.cjs.map +1 -1
- package/dist/cjs/utils/getComponentTransformPattern.cjs +1 -48
- package/dist/cjs/utils/getComponentTransformPattern.cjs.map +1 -1
- package/dist/cjs/utils/getFileHash.cjs +1 -12
- package/dist/cjs/utils/getFileHash.cjs.map +1 -1
- package/dist/cjs/utils/getFormatFromExtension.cjs +1 -31
- package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +1 -46
- package/dist/cjs/utils/pLimit.cjs +1 -128
- package/dist/cjs/utils/pLimit.cjs.map +1 -1
- package/dist/cjs/utils/parallelize.cjs +1 -11
- package/dist/cjs/utils/parallelize.cjs.map +1 -1
- package/dist/cjs/utils/parallelizeGlobal.cjs +1 -29
- package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -1
- package/dist/cjs/utils/reduceObjectFormat.cjs +1 -31
- package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -1
- package/dist/cjs/utils/resolveObjectPromises.cjs +1 -21
- package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
- package/dist/cjs/utils/runOnce.cjs +1 -95
- package/dist/cjs/utils/runOnce.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/bin.cjs +1 -54
- package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/bootstrap.cjs +1 -24
- package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/index.cjs +1 -110
- package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/pidTree.cjs +1 -145
- package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/ps.cjs +1 -49
- package/dist/cjs/utils/runParallel/ps.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/runTask.cjs +1 -154
- package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/spawnPosix.cjs +1 -59
- package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/spawnWin32.cjs +1 -43
- package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
- package/dist/cjs/utils/runParallel/wmic.cjs +1 -52
- package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -1
- package/dist/cjs/utils/sortAlphabetically.cjs +1 -7
- package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
- package/dist/cjs/utils/splitTextByLine.cjs +1 -11
- package/dist/cjs/utils/splitTextByLine.cjs.map +1 -1
- package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +1 -60
- package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -1
- package/dist/cjs/watcher.cjs +1 -95
- package/dist/cjs/watcher.cjs.map +1 -1
- package/dist/cjs/writeConfiguration/index.cjs +1 -34
- package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +1 -28
- package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs +1 -31
- package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/index.cjs +1 -12
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +1 -93
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +2 -1775
- package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +1 -77
- package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +1 -123
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +1 -71
- package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
- package/dist/cjs/writeFileIfChanged.cjs +1 -12
- package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
- package/dist/cjs/writeJsonIfChanged.cjs +1 -17
- package/dist/cjs/writeJsonIfChanged.cjs.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -8
- package/dist/esm/_virtual/_utils_asset.mjs +2 -97
- package/dist/esm/build.mjs +1 -24
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +1 -51
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/index.mjs +1 -4
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs +1 -24
- package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +4 -75
- package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +4 -59
- package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +1 -44
- package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +1 -48
- package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +1 -56
- package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
- package/dist/esm/cleanOutputDir.mjs +1 -28
- package/dist/esm/cleanOutputDir.mjs.map +1 -1
- package/dist/esm/cleanRemovedContentDeclaration.mjs +1 -93
- package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -1
- package/dist/esm/cli.mjs +1 -8
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +1 -68
- package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +7 -39
- package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +1 -20
- package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +1 -21
- package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +1 -21
- package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +1 -20
- package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +1 -20
- package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
- package/dist/esm/createDictionaryEntryPoint/index.mjs +1 -9
- package/dist/esm/createType/createModuleAugmentation.mjs +9 -106
- package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
- package/dist/esm/createType/createType.mjs +1 -26
- package/dist/esm/createType/createType.mjs.map +1 -1
- package/dist/esm/createType/index.mjs +1 -4
- package/dist/esm/fetchDistantDictionaries.mjs +1 -48
- package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/filterInvalidDictionaries.mjs +1 -46
- package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
- package/dist/esm/formatDictionary.mjs +1 -44
- package/dist/esm/formatDictionary.mjs.map +1 -1
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +1 -37
- package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -1
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs +1 -32
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
- package/dist/esm/handleContentDeclarationFileChange.mjs +1 -47
- package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
- package/dist/esm/handleContentDeclarationFileMoved.mjs +1 -22
- package/dist/esm/handleContentDeclarationFileMoved.mjs.map +1 -1
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +1 -35
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -57
- package/dist/esm/init/index.mjs +1 -240
- package/dist/esm/init/index.mjs.map +1 -1
- package/dist/esm/init/utils/configManipulation.mjs +1 -161
- package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
- package/dist/esm/init/utils/fileSystem.mjs +1 -26
- package/dist/esm/init/utils/fileSystem.mjs.map +1 -1
- package/dist/esm/init/utils/index.mjs +1 -6
- package/dist/esm/init/utils/jsonParser.mjs +3 -40
- package/dist/esm/init/utils/jsonParser.mjs.map +1 -1
- package/dist/esm/init/utils/tsConfig.mjs +1 -16
- package/dist/esm/init/utils/tsConfig.mjs.map +1 -1
- package/dist/esm/initConfig/index.mjs +1 -36
- package/dist/esm/initConfig/index.mjs.map +1 -1
- package/dist/esm/installSkills/index.mjs +1 -167
- package/dist/esm/installSkills/index.mjs.map +1 -1
- package/dist/esm/listDictionariesPath.mjs +1 -37
- package/dist/esm/listDictionariesPath.mjs.map +1 -1
- package/dist/esm/listGitFiles.mjs +5 -90
- package/dist/esm/listGitFiles.mjs.map +1 -1
- package/dist/esm/listProjects.mjs +1 -43
- package/dist/esm/listProjects.mjs.map +1 -1
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +1 -65
- package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
- package/dist/esm/loadDictionaries/index.mjs +1 -6
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +2 -69
- package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -123
- package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +1 -26
- package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +1 -58
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
- package/dist/esm/loadDictionaries/log.mjs +3 -132
- package/dist/esm/loadDictionaries/log.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +1 -92
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/reduceDictionaryContent/applyMask.mjs +1 -28
- package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -1
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +1 -10
- package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
- package/dist/esm/transformFiles/extractDictionaryKey.mjs +1 -14
- package/dist/esm/transformFiles/extractDictionaryKey.mjs.map +1 -1
- package/dist/esm/transformFiles/index.mjs +1 -4
- package/dist/esm/transformFiles/transformFiles.mjs +1 -244
- package/dist/esm/transformFiles/transformFiles.mjs.map +1 -1
- package/dist/esm/utils/autoDecorateContent.mjs +1 -85
- package/dist/esm/utils/autoDecorateContent.mjs.map +1 -1
- package/dist/esm/utils/buildFilesList.mjs +1 -47
- package/dist/esm/utils/buildFilesList.mjs.map +1 -1
- package/dist/esm/utils/chunkJSON.mjs +1 -333
- package/dist/esm/utils/chunkJSON.mjs.map +1 -1
- package/dist/esm/utils/formatter.mjs +1 -12
- package/dist/esm/utils/formatter.mjs.map +1 -1
- package/dist/esm/utils/getChunk.mjs +1 -33
- package/dist/esm/utils/getChunk.mjs.map +1 -1
- package/dist/esm/utils/getComponentTransformPattern.mjs +1 -44
- package/dist/esm/utils/getComponentTransformPattern.mjs.map +1 -1
- package/dist/esm/utils/getFileHash.mjs +1 -9
- package/dist/esm/utils/getFileHash.mjs.map +1 -1
- package/dist/esm/utils/getFormatFromExtension.mjs +1 -28
- package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +1 -20
- package/dist/esm/utils/pLimit.mjs +1 -125
- package/dist/esm/utils/pLimit.mjs.map +1 -1
- package/dist/esm/utils/parallelize.mjs +1 -10
- package/dist/esm/utils/parallelize.mjs.map +1 -1
- package/dist/esm/utils/parallelizeGlobal.mjs +1 -26
- package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -1
- package/dist/esm/utils/reduceObjectFormat.mjs +1 -29
- package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -1
- package/dist/esm/utils/resolveObjectPromises.mjs +1 -19
- package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -1
- package/dist/esm/utils/runOnce.mjs +1 -92
- package/dist/esm/utils/runOnce.mjs.map +1 -1
- package/dist/esm/utils/runParallel/bin.mjs +1 -52
- package/dist/esm/utils/runParallel/bin.mjs.map +1 -1
- package/dist/esm/utils/runParallel/bootstrap.mjs +1 -22
- package/dist/esm/utils/runParallel/bootstrap.mjs.map +1 -1
- package/dist/esm/utils/runParallel/index.mjs +1 -108
- package/dist/esm/utils/runParallel/index.mjs.map +1 -1
- package/dist/esm/utils/runParallel/pidTree.mjs +1 -142
- package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -1
- package/dist/esm/utils/runParallel/ps.mjs +1 -46
- package/dist/esm/utils/runParallel/ps.mjs.map +1 -1
- package/dist/esm/utils/runParallel/runTask.mjs +1 -152
- package/dist/esm/utils/runParallel/runTask.mjs.map +1 -1
- package/dist/esm/utils/runParallel/spawnPosix.mjs +1 -57
- package/dist/esm/utils/runParallel/spawnPosix.mjs.map +1 -1
- package/dist/esm/utils/runParallel/spawnWin32.mjs +1 -41
- package/dist/esm/utils/runParallel/spawnWin32.mjs.map +1 -1
- package/dist/esm/utils/runParallel/wmic.mjs +1 -49
- package/dist/esm/utils/runParallel/wmic.mjs.map +1 -1
- package/dist/esm/utils/sortAlphabetically.mjs +1 -5
- package/dist/esm/utils/sortAlphabetically.mjs.map +1 -1
- package/dist/esm/utils/splitTextByLine.mjs +1 -9
- package/dist/esm/utils/splitTextByLine.mjs.map +1 -1
- package/dist/esm/utils/verifyIdenticObjectFormat.mjs +1 -58
- package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -1
- package/dist/esm/watcher.mjs +1 -92
- package/dist/esm/watcher.mjs.map +1 -1
- package/dist/esm/writeConfiguration/index.mjs +1 -31
- package/dist/esm/writeConfiguration/index.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs +1 -26
- package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/detectFormatCommand.mjs +1 -29
- package/dist/esm/writeContentDeclaration/detectFormatCommand.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/index.mjs +1 -7
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +1 -91
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs +2 -1773
- package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/transformJSONFile.mjs +1 -75
- package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +1 -121
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs +1 -69
- package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
- package/dist/esm/writeFileIfChanged.mjs +1 -10
- package/dist/esm/writeFileIfChanged.mjs.map +1 -1
- package/dist/esm/writeJsonIfChanged.mjs +1 -16
- package/dist/esm/writeJsonIfChanged.mjs.map +1 -1
- package/dist/types/build.d.ts +3 -1
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
- package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/index.d.ts +16 -24
- package/dist/types/initConfig/index.d.ts +1 -1
- package/dist/types/initConfig/index.d.ts.map +1 -1
- package/dist/types/listGitFiles.d.ts.map +1 -1
- package/dist/types/loadDictionaries/getIntlayerBundle.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
- package/dist/types/prepareIntlayer.d.ts.map +1 -1
- package/dist/types/transformFiles/transformFiles.d.ts +1 -1
- package/dist/types/transformFiles/transformFiles.d.ts.map +1 -1
- package/dist/types/utils/formatter.d.ts +1 -1
- package/dist/types/watcher.d.ts +1 -1
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -1
- package/package.json +10 -15
|
@@ -1,50 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as os from "node:os";
|
|
3
|
-
|
|
4
|
-
//#region src/utils/runParallel/wmic.ts
|
|
5
|
-
/**
|
|
6
|
-
* Gets the list of all the pids of the system through the wmic command.
|
|
7
|
-
* @param callback Callback function with error and process list.
|
|
8
|
-
*/
|
|
9
|
-
const wmic = (callback) => {
|
|
10
|
-
run("wmic", [
|
|
11
|
-
"PROCESS",
|
|
12
|
-
"get",
|
|
13
|
-
"ParentProcessId,ProcessId"
|
|
14
|
-
], {
|
|
15
|
-
windowsHide: true,
|
|
16
|
-
windowsVerbatimArguments: true
|
|
17
|
-
}, (err, stdout, code) => {
|
|
18
|
-
if (err) {
|
|
19
|
-
callback(err);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (code !== 0) {
|
|
23
|
-
callback(/* @__PURE__ */ new Error(`pidtree wmic command exited with code ${code}`));
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (!stdout) {
|
|
27
|
-
callback(/* @__PURE__ */ new Error("No stdout received from wmic command"));
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
const lines = stdout.split(os.EOL);
|
|
32
|
-
const list = [];
|
|
33
|
-
for (let i = 1; i < lines.length; i++) {
|
|
34
|
-
const trimmed = lines[i].trim();
|
|
35
|
-
if (!trimmed) continue;
|
|
36
|
-
const parts = trimmed.split(/\s+/);
|
|
37
|
-
const ppid = parseInt(parts[0], 10);
|
|
38
|
-
const pid = parseInt(parts[1], 10);
|
|
39
|
-
if (!Number.isNaN(ppid) && !Number.isNaN(pid)) list.push([ppid, pid]);
|
|
40
|
-
}
|
|
41
|
-
callback(null, list);
|
|
42
|
-
} catch (error) {
|
|
43
|
-
callback(error instanceof Error ? error : new Error(String(error)));
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
|
-
export { wmic };
|
|
1
|
+
import{run as e}from"./bin.mjs";import*as t from"node:os";const n=n=>{e(`wmic`,[`PROCESS`,`get`,`ParentProcessId,ProcessId`],{windowsHide:!0,windowsVerbatimArguments:!0},(e,r,i)=>{if(e){n(e);return}if(i!==0){n(Error(`pidtree wmic command exited with code ${i}`));return}if(!r){n(Error(`No stdout received from wmic command`));return}try{let e=r.split(t.EOL),i=[];for(let t=1;t<e.length;t++){let n=e[t].trim();if(!n)continue;let r=n.split(/\s+/),a=parseInt(r[0],10),o=parseInt(r[1],10);!Number.isNaN(a)&&!Number.isNaN(o)&&i.push([a,o])}n(null,i)}catch(e){n(e instanceof Error?e:Error(String(e)))}})};export{n as wmic};
|
|
50
2
|
//# sourceMappingURL=wmic.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wmic.mjs","names":[],"sources":["../../../../src/utils/runParallel/wmic.ts"],"sourcesContent":["import type { SpawnOptions } from 'node:child_process';\nimport * as os from 'node:os';\nimport { run } from './bin';\n\ntype ProcessList = [number, number][]; // [PPID, PID][]\ntype ProcessListCallback = (err: Error | null, list?: ProcessList) => void;\n\n/**\n * Gets the list of all the pids of the system through the wmic command.\n * @param callback Callback function with error and process list.\n */\nexport const wmic = (callback: ProcessListCallback): void => {\n const args = ['PROCESS', 'get', 'ParentProcessId,ProcessId'];\n const options: SpawnOptions = {\n windowsHide: true,\n windowsVerbatimArguments: true,\n };\n run('wmic', args, options, (err, stdout, code) => {\n if (err) {\n callback(err);\n return;\n }\n\n if (code !== 0) {\n callback(new Error(`pidtree wmic command exited with code ${code}`));\n return;\n }\n\n // Example of stdout\n //\n // ParentProcessId ProcessId\n // 0 777\n\n if (!stdout) {\n callback(new Error('No stdout received from wmic command'));\n return;\n }\n\n try {\n const lines = stdout.split(os.EOL);\n\n const list: ProcessList = [];\n for (let i = 1; i < lines.length; i++) {\n const trimmed = lines[i].trim();\n if (!trimmed) continue;\n const parts = trimmed.split(/\\s+/);\n const ppid = parseInt(parts[0], 10); // PPID\n const pid = parseInt(parts[1], 10); // PID\n if (!Number.isNaN(ppid) && !Number.isNaN(pid)) {\n list.push([ppid, pid]);\n }\n }\n\n callback(null, list);\n } catch (error) {\n callback(error instanceof Error ? error : new Error(String(error)));\n }\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"wmic.mjs","names":[],"sources":["../../../../src/utils/runParallel/wmic.ts"],"sourcesContent":["import type { SpawnOptions } from 'node:child_process';\nimport * as os from 'node:os';\nimport { run } from './bin';\n\ntype ProcessList = [number, number][]; // [PPID, PID][]\ntype ProcessListCallback = (err: Error | null, list?: ProcessList) => void;\n\n/**\n * Gets the list of all the pids of the system through the wmic command.\n * @param callback Callback function with error and process list.\n */\nexport const wmic = (callback: ProcessListCallback): void => {\n const args = ['PROCESS', 'get', 'ParentProcessId,ProcessId'];\n const options: SpawnOptions = {\n windowsHide: true,\n windowsVerbatimArguments: true,\n };\n run('wmic', args, options, (err, stdout, code) => {\n if (err) {\n callback(err);\n return;\n }\n\n if (code !== 0) {\n callback(new Error(`pidtree wmic command exited with code ${code}`));\n return;\n }\n\n // Example of stdout\n //\n // ParentProcessId ProcessId\n // 0 777\n\n if (!stdout) {\n callback(new Error('No stdout received from wmic command'));\n return;\n }\n\n try {\n const lines = stdout.split(os.EOL);\n\n const list: ProcessList = [];\n for (let i = 1; i < lines.length; i++) {\n const trimmed = lines[i].trim();\n if (!trimmed) continue;\n const parts = trimmed.split(/\\s+/);\n const ppid = parseInt(parts[0], 10); // PPID\n const pid = parseInt(parts[1], 10); // PID\n if (!Number.isNaN(ppid) && !Number.isNaN(pid)) {\n list.push([ppid, pid]);\n }\n }\n\n callback(null, list);\n } catch (error) {\n callback(error instanceof Error ? error : new Error(String(error)));\n }\n });\n};\n"],"mappings":"0DAWA,MAAa,EAAQ,GAAwC,CAM3D,EAAI,OALS,CAAC,UAAW,MAAO,4BAA4B,CAC9B,CAC5B,YAAa,GACb,yBAA0B,GAC3B,EAC2B,EAAK,EAAQ,IAAS,CAChD,GAAI,EAAK,CACP,EAAS,EAAI,CACb,OAGF,GAAI,IAAS,EAAG,CACd,EAAa,MAAM,yCAAyC,IAAO,CAAC,CACpE,OAQF,GAAI,CAAC,EAAQ,CACX,EAAa,MAAM,uCAAuC,CAAC,CAC3D,OAGF,GAAI,CACF,IAAM,EAAQ,EAAO,MAAM,EAAG,IAAI,CAE5B,EAAoB,EAAE,CAC5B,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,OAAQ,IAAK,CACrC,IAAM,EAAU,EAAM,GAAG,MAAM,CAC/B,GAAI,CAAC,EAAS,SACd,IAAM,EAAQ,EAAQ,MAAM,MAAM,CAC5B,EAAO,SAAS,EAAM,GAAI,GAAG,CAC7B,EAAM,SAAS,EAAM,GAAI,GAAG,CAC9B,CAAC,OAAO,MAAM,EAAK,EAAI,CAAC,OAAO,MAAM,EAAI,EAC3C,EAAK,KAAK,CAAC,EAAM,EAAI,CAAC,CAI1B,EAAS,KAAM,EAAK,OACb,EAAO,CACd,EAAS,aAAiB,MAAQ,EAAY,MAAM,OAAO,EAAM,CAAC,CAAC,GAErE"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const sortAlphabetically = (a, b) => a.localeCompare(b);
|
|
3
|
-
|
|
4
|
-
//#endregion
|
|
5
|
-
export { sortAlphabetically };
|
|
1
|
+
const e=(e,t)=>e.localeCompare(t);export{e as sortAlphabetically};
|
|
6
2
|
//# sourceMappingURL=sortAlphabetically.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortAlphabetically.mjs","names":[],"sources":["../../../src/utils/sortAlphabetically.ts"],"sourcesContent":["export const sortAlphabetically = (a: string, b: string) => a.localeCompare(b);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sortAlphabetically.mjs","names":[],"sources":["../../../src/utils/sortAlphabetically.ts"],"sourcesContent":["export const sortAlphabetically = (a: string, b: string) => a.localeCompare(b);\n"],"mappings":"AAAA,MAAa,GAAsB,EAAW,IAAc,EAAE,cAAc,EAAE"}
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const splitTextByLines = (text) => {
|
|
3
|
-
const splittedText = text.match(/[^\n]*\n|[^\n]*$/g) ?? [];
|
|
4
|
-
if (splittedText.length > 0 && splittedText.at(-1) === "") splittedText.pop();
|
|
5
|
-
return splittedText;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { splitTextByLines };
|
|
1
|
+
const e=e=>{let t=e.match(/[^\n]*\n|[^\n]*$/g)??[];return t.length>0&&t.at(-1)===``&&t.pop(),t};export{e as splitTextByLines};
|
|
10
2
|
//# sourceMappingURL=splitTextByLine.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitTextByLine.mjs","names":[],"sources":["../../../src/utils/splitTextByLine.ts"],"sourcesContent":["export const splitTextByLines = (text: string): string[] => {\n const splittedText = text.match(/[^\\n]*\\n|[^\\n]*$/g) ?? [];\n\n if (splittedText.length > 0 && splittedText.at(-1) === '') {\n splittedText.pop();\n }\n\n return splittedText;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"splitTextByLine.mjs","names":[],"sources":["../../../src/utils/splitTextByLine.ts"],"sourcesContent":["export const splitTextByLines = (text: string): string[] => {\n const splittedText = text.match(/[^\\n]*\\n|[^\\n]*$/g) ?? [];\n\n if (splittedText.length > 0 && splittedText.at(-1) === '') {\n splittedText.pop();\n }\n\n return splittedText;\n};\n"],"mappings":"AAAA,MAAa,EAAoB,GAA2B,CAC1D,IAAM,EAAe,EAAK,MAAM,oBAAoB,EAAI,EAAE,CAM1D,OAJI,EAAa,OAAS,GAAK,EAAa,GAAG,GAAG,GAAK,IACrD,EAAa,KAAK,CAGb"}
|
|
@@ -1,59 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Verifies that two objects have identical structure (same keys, array lengths, and types)
|
|
4
|
-
* but not necessarily the same values.
|
|
5
|
-
* Useful for validating translations maintain the same format as the original.
|
|
6
|
-
*
|
|
7
|
-
* @param object - The object to verify
|
|
8
|
-
* @param expectedFormat - The expected format to compare against
|
|
9
|
-
* @param path - Current path in the object tree (for error messages)
|
|
10
|
-
* @returns true if structures match, throws error with details if they don't
|
|
11
|
-
*/
|
|
12
|
-
const verifyIdenticObjectFormat = (object, expectedFormat, path = "root") => {
|
|
13
|
-
if (expectedFormat === null || expectedFormat === void 0) {
|
|
14
|
-
if (expectedFormat !== object) return {
|
|
15
|
-
isIdentic: false,
|
|
16
|
-
error: `Type mismatch at ${path}: expected ${expectedFormat === null ? "null" : "undefined"}, got ${object === null ? "null" : typeof object}`
|
|
17
|
-
};
|
|
18
|
-
return { isIdentic: true };
|
|
19
|
-
}
|
|
20
|
-
const expectedType = Array.isArray(expectedFormat) ? "array" : typeof expectedFormat;
|
|
21
|
-
const objectType = Array.isArray(object) ? "array" : typeof object;
|
|
22
|
-
if (expectedType !== objectType) return {
|
|
23
|
-
isIdentic: false,
|
|
24
|
-
error: `Type mismatch at ${path}: expected ${expectedType}, got ${objectType}`
|
|
25
|
-
};
|
|
26
|
-
if (Array.isArray(expectedFormat) && Array.isArray(object)) {
|
|
27
|
-
if (expectedFormat.length !== object.length) return {
|
|
28
|
-
isIdentic: false,
|
|
29
|
-
error: `Array length mismatch at ${path}: expected ${expectedFormat.length} elements, got ${object.length}`
|
|
30
|
-
};
|
|
31
|
-
for (let i = 0; i < expectedFormat.length; i++) {
|
|
32
|
-
const result = verifyIdenticObjectFormat(object[i], expectedFormat[i], `${path}[${i}]`);
|
|
33
|
-
if (!result.isIdentic) return result;
|
|
34
|
-
}
|
|
35
|
-
return { isIdentic: true };
|
|
36
|
-
}
|
|
37
|
-
if (typeof expectedFormat === "object" && typeof object === "object" && expectedFormat !== null && object !== null) {
|
|
38
|
-
const expectedKeys = Object.keys(expectedFormat);
|
|
39
|
-
const objectKeys = Object.keys(object);
|
|
40
|
-
if (expectedKeys.length !== objectKeys.length) return {
|
|
41
|
-
isIdentic: false,
|
|
42
|
-
error: `Object keys count mismatch at ${path}: expected ${expectedKeys.length} keys, got ${objectKeys.length}`
|
|
43
|
-
};
|
|
44
|
-
for (let i = 0; i < expectedKeys.length; i++) if (expectedKeys[i] !== objectKeys[i]) return {
|
|
45
|
-
isIdentic: false,
|
|
46
|
-
error: `Object keys mismatch at ${path}: expected key "${expectedKeys[i]}" at position ${i}, got "${objectKeys[i]}"`
|
|
47
|
-
};
|
|
48
|
-
for (const key of expectedKeys) {
|
|
49
|
-
const result = verifyIdenticObjectFormat(object[key], expectedFormat[key], `${path}.${key}`);
|
|
50
|
-
if (!result.isIdentic) return result;
|
|
51
|
-
}
|
|
52
|
-
return { isIdentic: true };
|
|
53
|
-
}
|
|
54
|
-
return { isIdentic: true };
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
//#endregion
|
|
58
|
-
export { verifyIdenticObjectFormat };
|
|
1
|
+
const e=(t,n,r=`root`)=>{if(n==null)return n===t?{isIdentic:!0}:{isIdentic:!1,error:`Type mismatch at ${r}: expected ${n===null?`null`:`undefined`}, got ${t===null?`null`:typeof t}`};let i=Array.isArray(n)?`array`:typeof n,a=Array.isArray(t)?`array`:typeof t;if(i!==a)return{isIdentic:!1,error:`Type mismatch at ${r}: expected ${i}, got ${a}`};if(Array.isArray(n)&&Array.isArray(t)){if(n.length!==t.length)return{isIdentic:!1,error:`Array length mismatch at ${r}: expected ${n.length} elements, got ${t.length}`};for(let i=0;i<n.length;i++){let a=e(t[i],n[i],`${r}[${i}]`);if(!a.isIdentic)return a}return{isIdentic:!0}}if(typeof n==`object`&&typeof t==`object`&&n!==null&&t!==null){let i=Object.keys(n),a=Object.keys(t);if(i.length!==a.length)return{isIdentic:!1,error:`Object keys count mismatch at ${r}: expected ${i.length} keys, got ${a.length}`};for(let e=0;e<i.length;e++)if(i[e]!==a[e])return{isIdentic:!1,error:`Object keys mismatch at ${r}: expected key "${i[e]}" at position ${e}, got "${a[e]}"`};for(let a of i){let i=e(t[a],n[a],`${r}.${a}`);if(!i.isIdentic)return i}return{isIdentic:!0}}return{isIdentic:!0}};export{e as verifyIdenticObjectFormat};
|
|
59
2
|
//# sourceMappingURL=verifyIdenticObjectFormat.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyIdenticObjectFormat.mjs","names":[],"sources":["../../../src/utils/verifyIdenticObjectFormat.ts"],"sourcesContent":["type FlatType = string | number | boolean | object | null | undefined;\n\ntype RecursiveType =\n | FlatType\n | { [key: string]: RecursiveType }\n | Array<RecursiveType>;\n\ntype VerifyIdenticObjectFormatResult = {\n isIdentic: boolean;\n error?: string;\n};\n\n/**\n * Verifies that two objects have identical structure (same keys, array lengths, and types)\n * but not necessarily the same values.\n * Useful for validating translations maintain the same format as the original.\n *\n * @param object - The object to verify\n * @param expectedFormat - The expected format to compare against\n * @param path - Current path in the object tree (for error messages)\n * @returns true if structures match, throws error with details if they don't\n */\nexport const verifyIdenticObjectFormat = (\n object: RecursiveType,\n expectedFormat: RecursiveType,\n path: string = 'root'\n): VerifyIdenticObjectFormatResult => {\n // Check if both are null or undefined\n if (expectedFormat === null || expectedFormat === undefined) {\n if (expectedFormat !== object) {\n return {\n isIdentic: false,\n error: `Type mismatch at ${path}: expected ${expectedFormat === null ? 'null' : 'undefined'}, got ${object === null ? 'null' : typeof object}`,\n };\n }\n return {\n isIdentic: true,\n };\n }\n\n // Get the type of both values\n const expectedType = Array.isArray(expectedFormat)\n ? 'array'\n : typeof expectedFormat;\n const objectType = Array.isArray(object) ? 'array' : typeof object;\n\n // Check if types match\n if (expectedType !== objectType) {\n return {\n isIdentic: false,\n error: `Type mismatch at ${path}: expected ${expectedType}, got ${objectType}`,\n };\n }\n\n // Handle arrays\n if (Array.isArray(expectedFormat) && Array.isArray(object)) {\n if (expectedFormat.length !== object.length) {\n return {\n isIdentic: false,\n error: `Array length mismatch at ${path}: expected ${expectedFormat.length} elements, got ${object.length}`,\n };\n }\n\n // Recursively check each element\n for (let i = 0; i < expectedFormat.length; i++) {\n const result = verifyIdenticObjectFormat(\n object[i],\n expectedFormat[i],\n `${path}[${i}]`\n );\n if (!result.isIdentic) {\n return result;\n }\n }\n\n return {\n isIdentic: true,\n };\n }\n\n // Handle objects (excluding null and arrays)\n if (\n typeof expectedFormat === 'object' &&\n typeof object === 'object' &&\n expectedFormat !== null &&\n object !== null\n ) {\n const expectedKeys = Object.keys(expectedFormat);\n const objectKeys = Object.keys(object);\n\n // Check if number of keys match\n if (expectedKeys.length !== objectKeys.length) {\n return {\n isIdentic: false,\n error: `Object keys count mismatch at ${path}: expected ${expectedKeys.length} keys, got ${objectKeys.length}`,\n };\n }\n\n // Check if keys match and are in the same order\n for (let i = 0; i < expectedKeys.length; i++) {\n if (expectedKeys[i] !== objectKeys[i]) {\n return {\n isIdentic: false,\n error: `Object keys mismatch at ${path}: expected key \"${expectedKeys[i]}\" at position ${i}, got \"${objectKeys[i]}\"`,\n };\n }\n }\n\n // Recursively check each property\n for (const key of expectedKeys) {\n const result = verifyIdenticObjectFormat(\n (object as Record<string, RecursiveType>)[key],\n (expectedFormat as Record<string, RecursiveType>)[key],\n `${path}.${key}`\n );\n if (!result.isIdentic) {\n return result;\n }\n }\n\n return {\n isIdentic: true,\n };\n }\n\n // For primitive types (string, number, boolean), just verify they're the same type\n // We don't check the actual values as per requirements\n return {\n isIdentic: true,\n };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"verifyIdenticObjectFormat.mjs","names":[],"sources":["../../../src/utils/verifyIdenticObjectFormat.ts"],"sourcesContent":["type FlatType = string | number | boolean | object | null | undefined;\n\ntype RecursiveType =\n | FlatType\n | { [key: string]: RecursiveType }\n | Array<RecursiveType>;\n\ntype VerifyIdenticObjectFormatResult = {\n isIdentic: boolean;\n error?: string;\n};\n\n/**\n * Verifies that two objects have identical structure (same keys, array lengths, and types)\n * but not necessarily the same values.\n * Useful for validating translations maintain the same format as the original.\n *\n * @param object - The object to verify\n * @param expectedFormat - The expected format to compare against\n * @param path - Current path in the object tree (for error messages)\n * @returns true if structures match, throws error with details if they don't\n */\nexport const verifyIdenticObjectFormat = (\n object: RecursiveType,\n expectedFormat: RecursiveType,\n path: string = 'root'\n): VerifyIdenticObjectFormatResult => {\n // Check if both are null or undefined\n if (expectedFormat === null || expectedFormat === undefined) {\n if (expectedFormat !== object) {\n return {\n isIdentic: false,\n error: `Type mismatch at ${path}: expected ${expectedFormat === null ? 'null' : 'undefined'}, got ${object === null ? 'null' : typeof object}`,\n };\n }\n return {\n isIdentic: true,\n };\n }\n\n // Get the type of both values\n const expectedType = Array.isArray(expectedFormat)\n ? 'array'\n : typeof expectedFormat;\n const objectType = Array.isArray(object) ? 'array' : typeof object;\n\n // Check if types match\n if (expectedType !== objectType) {\n return {\n isIdentic: false,\n error: `Type mismatch at ${path}: expected ${expectedType}, got ${objectType}`,\n };\n }\n\n // Handle arrays\n if (Array.isArray(expectedFormat) && Array.isArray(object)) {\n if (expectedFormat.length !== object.length) {\n return {\n isIdentic: false,\n error: `Array length mismatch at ${path}: expected ${expectedFormat.length} elements, got ${object.length}`,\n };\n }\n\n // Recursively check each element\n for (let i = 0; i < expectedFormat.length; i++) {\n const result = verifyIdenticObjectFormat(\n object[i],\n expectedFormat[i],\n `${path}[${i}]`\n );\n if (!result.isIdentic) {\n return result;\n }\n }\n\n return {\n isIdentic: true,\n };\n }\n\n // Handle objects (excluding null and arrays)\n if (\n typeof expectedFormat === 'object' &&\n typeof object === 'object' &&\n expectedFormat !== null &&\n object !== null\n ) {\n const expectedKeys = Object.keys(expectedFormat);\n const objectKeys = Object.keys(object);\n\n // Check if number of keys match\n if (expectedKeys.length !== objectKeys.length) {\n return {\n isIdentic: false,\n error: `Object keys count mismatch at ${path}: expected ${expectedKeys.length} keys, got ${objectKeys.length}`,\n };\n }\n\n // Check if keys match and are in the same order\n for (let i = 0; i < expectedKeys.length; i++) {\n if (expectedKeys[i] !== objectKeys[i]) {\n return {\n isIdentic: false,\n error: `Object keys mismatch at ${path}: expected key \"${expectedKeys[i]}\" at position ${i}, got \"${objectKeys[i]}\"`,\n };\n }\n }\n\n // Recursively check each property\n for (const key of expectedKeys) {\n const result = verifyIdenticObjectFormat(\n (object as Record<string, RecursiveType>)[key],\n (expectedFormat as Record<string, RecursiveType>)[key],\n `${path}.${key}`\n );\n if (!result.isIdentic) {\n return result;\n }\n }\n\n return {\n isIdentic: true,\n };\n }\n\n // For primitive types (string, number, boolean), just verify they're the same type\n // We don't check the actual values as per requirements\n return {\n isIdentic: true,\n };\n};\n"],"mappings":"AAsBA,MAAa,GACX,EACA,EACA,EAAe,SACqB,CAEpC,GAAI,GAAmB,KAOrB,OANI,IAAmB,EAMhB,CACL,UAAW,GACZ,CAPQ,CACL,UAAW,GACX,MAAO,oBAAoB,EAAK,aAAa,IAAmB,KAAO,OAAS,YAAY,QAAQ,IAAW,KAAO,OAAS,OAAO,IACvI,CAQL,IAAM,EAAe,MAAM,QAAQ,EAAe,CAC9C,QACA,OAAO,EACL,EAAa,MAAM,QAAQ,EAAO,CAAG,QAAU,OAAO,EAG5D,GAAI,IAAiB,EACnB,MAAO,CACL,UAAW,GACX,MAAO,oBAAoB,EAAK,aAAa,EAAa,QAAQ,IACnE,CAIH,GAAI,MAAM,QAAQ,EAAe,EAAI,MAAM,QAAQ,EAAO,CAAE,CAC1D,GAAI,EAAe,SAAW,EAAO,OACnC,MAAO,CACL,UAAW,GACX,MAAO,4BAA4B,EAAK,aAAa,EAAe,OAAO,iBAAiB,EAAO,SACpG,CAIH,IAAK,IAAI,EAAI,EAAG,EAAI,EAAe,OAAQ,IAAK,CAC9C,IAAM,EAAS,EACb,EAAO,GACP,EAAe,GACf,GAAG,EAAK,GAAG,EAAE,GACd,CACD,GAAI,CAAC,EAAO,UACV,OAAO,EAIX,MAAO,CACL,UAAW,GACZ,CAIH,GACE,OAAO,GAAmB,UAC1B,OAAO,GAAW,UAClB,IAAmB,MACnB,IAAW,KACX,CACA,IAAM,EAAe,OAAO,KAAK,EAAe,CAC1C,EAAa,OAAO,KAAK,EAAO,CAGtC,GAAI,EAAa,SAAW,EAAW,OACrC,MAAO,CACL,UAAW,GACX,MAAO,iCAAiC,EAAK,aAAa,EAAa,OAAO,aAAa,EAAW,SACvG,CAIH,IAAK,IAAI,EAAI,EAAG,EAAI,EAAa,OAAQ,IACvC,GAAI,EAAa,KAAO,EAAW,GACjC,MAAO,CACL,UAAW,GACX,MAAO,2BAA2B,EAAK,kBAAkB,EAAa,GAAG,gBAAgB,EAAE,SAAS,EAAW,GAAG,GACnH,CAKL,IAAK,IAAM,KAAO,EAAc,CAC9B,IAAM,EAAS,EACZ,EAAyC,GACzC,EAAiD,GAClD,GAAG,EAAK,GAAG,IACZ,CACD,GAAI,CAAC,EAAO,UACV,OAAO,EAIX,MAAO,CACL,UAAW,GACZ,CAKH,MAAO,CACL,UAAW,GACZ"}
|
package/dist/esm/watcher.mjs
CHANGED
|
@@ -1,93 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { writeContentDeclaration } from "./writeContentDeclaration/writeContentDeclaration.mjs";
|
|
3
|
-
import { handleAdditionalContentDeclarationFile } from "./handleAdditionalContentDeclarationFile.mjs";
|
|
4
|
-
import { handleContentDeclarationFileChange } from "./handleContentDeclarationFileChange.mjs";
|
|
5
|
-
import { handleContentDeclarationFileMoved } from "./handleContentDeclarationFileMoved.mjs";
|
|
6
|
-
import { handleUnlinkedContentDeclarationFile } from "./handleUnlinkedContentDeclarationFile.mjs";
|
|
7
|
-
import { getAppLogger, getConfiguration } from "@intlayer/config";
|
|
8
|
-
import { readFile } from "node:fs/promises";
|
|
9
|
-
import { basename } from "node:path";
|
|
10
|
-
import { watch as watch$1 } from "chokidar";
|
|
11
|
-
|
|
12
|
-
//#region src/watcher.ts
|
|
13
|
-
/** @ts-ignore remove error Module '"chokidar"' has no exported member 'ChokidarOptions' */
|
|
14
|
-
const pendingUnlinks = /* @__PURE__ */ new Map();
|
|
15
|
-
const watch = (options) => {
|
|
16
|
-
const configuration = options?.configuration ?? getConfiguration(options?.configOptions);
|
|
17
|
-
const appLogger = getAppLogger(configuration);
|
|
18
|
-
const { watch: isWatchMode, watchedFilesPatternWithPath, fileExtensions } = configuration.content;
|
|
19
|
-
return watch$1(watchedFilesPatternWithPath, {
|
|
20
|
-
persistent: isWatchMode,
|
|
21
|
-
ignoreInitial: true,
|
|
22
|
-
awaitWriteFinish: {
|
|
23
|
-
stabilityThreshold: 1e3,
|
|
24
|
-
pollInterval: 100
|
|
25
|
-
},
|
|
26
|
-
ignored: [
|
|
27
|
-
"**/node_modules/**",
|
|
28
|
-
"**/dist/**",
|
|
29
|
-
"**/build/**",
|
|
30
|
-
"**/.intlayer/**"
|
|
31
|
-
],
|
|
32
|
-
...options
|
|
33
|
-
}).on("add", async (filePath) => {
|
|
34
|
-
const fileName = basename(filePath);
|
|
35
|
-
let isMove = false;
|
|
36
|
-
let matchedOldPath;
|
|
37
|
-
for (const [oldPath] of pendingUnlinks) if (basename(oldPath) === fileName) {
|
|
38
|
-
matchedOldPath = oldPath;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
if (!matchedOldPath && pendingUnlinks.size === 1) matchedOldPath = pendingUnlinks.keys().next().value;
|
|
42
|
-
if (matchedOldPath) {
|
|
43
|
-
const pending = pendingUnlinks.get(matchedOldPath);
|
|
44
|
-
if (pending) {
|
|
45
|
-
clearTimeout(pending.timer);
|
|
46
|
-
pendingUnlinks.delete(matchedOldPath);
|
|
47
|
-
}
|
|
48
|
-
isMove = true;
|
|
49
|
-
appLogger(`File moved from ${matchedOldPath} to ${filePath}`);
|
|
50
|
-
await handleContentDeclarationFileMoved(matchedOldPath, filePath, configuration);
|
|
51
|
-
}
|
|
52
|
-
if (!isMove) {
|
|
53
|
-
if (await readFile(filePath, "utf-8") === "") {
|
|
54
|
-
const extensionPattern = fileExtensions.map((ext) => ext.replace(/\./g, "\\.")).join("|");
|
|
55
|
-
await writeContentDeclaration({
|
|
56
|
-
key: fileName.replace(new RegExp(`(${extensionPattern})$`), ""),
|
|
57
|
-
content: {},
|
|
58
|
-
filePath
|
|
59
|
-
}, configuration);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
await handleAdditionalContentDeclarationFile(filePath, configuration);
|
|
63
|
-
}).on("change", async (filePath) => await handleContentDeclarationFileChange(filePath, configuration)).on("unlink", async (filePath) => {
|
|
64
|
-
const timer = setTimeout(async () => {
|
|
65
|
-
pendingUnlinks.delete(filePath);
|
|
66
|
-
await handleUnlinkedContentDeclarationFile(filePath, configuration);
|
|
67
|
-
}, 200);
|
|
68
|
-
pendingUnlinks.set(filePath, {
|
|
69
|
-
timer,
|
|
70
|
-
oldPath: filePath
|
|
71
|
-
});
|
|
72
|
-
}).on("error", async (error) => {
|
|
73
|
-
appLogger(`Watcher error: ${error}`, { level: "error" });
|
|
74
|
-
appLogger("Restarting watcher");
|
|
75
|
-
await prepareIntlayer(configuration);
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
const buildAndWatchIntlayer = async (options) => {
|
|
79
|
-
const { skipPrepare, ...rest } = options ?? {};
|
|
80
|
-
const configuration = options?.configuration ?? getConfiguration(options?.configOptions);
|
|
81
|
-
if (!skipPrepare) await prepareIntlayer(configuration, { forceRun: true });
|
|
82
|
-
if (configuration.content.watch || options?.persistent) {
|
|
83
|
-
getAppLogger(configuration)("Watching Intlayer content declarations");
|
|
84
|
-
watch({
|
|
85
|
-
...rest,
|
|
86
|
-
configuration
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
//#endregion
|
|
92
|
-
export { buildAndWatchIntlayer, watch };
|
|
1
|
+
import{prepareIntlayer as e}from"./prepareIntlayer.mjs";import{writeContentDeclaration as t}from"./writeContentDeclaration/writeContentDeclaration.mjs";import{handleAdditionalContentDeclarationFile as n}from"./handleAdditionalContentDeclarationFile.mjs";import{handleContentDeclarationFileChange as r}from"./handleContentDeclarationFileChange.mjs";import{handleContentDeclarationFileMoved as i}from"./handleContentDeclarationFileMoved.mjs";import{handleUnlinkedContentDeclarationFile as a}from"./handleUnlinkedContentDeclarationFile.mjs";import{getConfiguration as o}from"@intlayer/config/node";import{readFile as s}from"node:fs/promises";import{basename as c}from"node:path";import{getAppLogger as l}from"@intlayer/config/logger";import{watch as u}from"chokidar";const d=new Map,f=f=>{let p=f?.configuration??o(f?.configOptions),m=l(p),{watch:h,watchedFilesPatternWithPath:g,fileExtensions:_}=p.content;return u(g,{persistent:h,ignoreInitial:!0,awaitWriteFinish:{stabilityThreshold:1e3,pollInterval:100},ignored:[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.intlayer/**`],...f}).on(`add`,async e=>{let r=c(e),a=!1,o;for(let[e]of d)if(c(e)===r){o=e;break}if(!o&&d.size===1&&(o=d.keys().next().value),o){let t=d.get(o);t&&(clearTimeout(t.timer),d.delete(o)),a=!0,m(`File moved from ${o} to ${e}`),await i(o,e,p)}if(!a&&await s(e,`utf-8`)===``){let n=_.map(e=>e.replace(/\./g,`\\.`)).join(`|`);await t({key:r.replace(RegExp(`(${n})$`),``),content:{},filePath:e},p)}await n(e,p)}).on(`change`,async e=>await r(e,p)).on(`unlink`,async e=>{let t=setTimeout(async()=>{d.delete(e),await a(e,p)},200);d.set(e,{timer:t,oldPath:e})}).on(`error`,async t=>{m(`Watcher error: ${t}`,{level:`error`}),m(`Restarting watcher`),await e(p)})},p=async t=>{let{skipPrepare:n,...r}=t??{},i=t?.configuration??o(t?.configOptions);n||await e(i,{forceRun:!0}),(i.content.watch||t?.persistent)&&(l(i)(`Watching Intlayer content declarations`),f({...r,configuration:i}))};export{p as buildAndWatchIntlayer,f as watch};
|
|
93
2
|
//# sourceMappingURL=watcher.mjs.map
|
package/dist/esm/watcher.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watcher.mjs","names":["chokidarWatch"],"sources":["../../src/watcher.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { basename } from 'node:path';\nimport {\n type GetConfigurationOptions,\n
|
|
1
|
+
{"version":3,"file":"watcher.mjs","names":["chokidarWatch"],"sources":["../../src/watcher.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { basename } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { IntlayerConfig } from '@intlayer/types';\n/** @ts-ignore remove error Module '\"chokidar\"' has no exported member 'ChokidarOptions' */\nimport { type ChokidarOptions, watch as chokidarWatch } from 'chokidar';\nimport { handleAdditionalContentDeclarationFile } from './handleAdditionalContentDeclarationFile';\nimport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nimport { handleContentDeclarationFileMoved } from './handleContentDeclarationFileMoved';\nimport { handleUnlinkedContentDeclarationFile } from './handleUnlinkedContentDeclarationFile';\nimport { prepareIntlayer } from './prepareIntlayer';\nimport { writeContentDeclaration } from './writeContentDeclaration';\n\n// Map to track files that were recently unlinked: oldPath -> { timer, timestamp }\nconst pendingUnlinks = new Map<\n string,\n { timer: NodeJS.Timeout; oldPath: string }\n>();\n\ntype WatchOptions = ChokidarOptions & {\n configuration?: IntlayerConfig;\n configOptions?: GetConfigurationOptions;\n skipPrepare?: boolean;\n};\n\n// Initialize chokidar watcher (non-persistent)\nexport const watch = (options?: WatchOptions) => {\n const configuration: IntlayerConfig =\n options?.configuration ?? getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(configuration);\n\n const {\n watch: isWatchMode,\n watchedFilesPatternWithPath,\n fileExtensions,\n } = configuration.content;\n\n return chokidarWatch(watchedFilesPatternWithPath, {\n persistent: isWatchMode, // Make the watcher persistent\n ignoreInitial: true, // Process existing files\n awaitWriteFinish: {\n stabilityThreshold: 1000,\n pollInterval: 100,\n },\n ignored: [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n '**/.intlayer/**',\n ],\n ...options,\n })\n .on('add', async (filePath) => {\n const fileName = basename(filePath);\n let isMove = false;\n\n // Check if this Add corresponds to a pending Unlink (Move/Rename detection)\n // Heuristic:\n // - Priority A: Exact basename match (Moved to different folder)\n // - Priority B: Single entry in pendingUnlinks (Renamed file)\n let matchedOldPath: string | undefined;\n\n // Search for basename match\n for (const [oldPath] of pendingUnlinks) {\n if (basename(oldPath) === fileName) {\n matchedOldPath = oldPath;\n break;\n }\n }\n\n // If no basename match, but exactly one file was recently unlinked, assume it's a rename\n if (!matchedOldPath && pendingUnlinks.size === 1) {\n matchedOldPath = pendingUnlinks.keys().next().value;\n }\n\n if (matchedOldPath) {\n // It is a move! Cancel the unlink handler\n const pending = pendingUnlinks.get(matchedOldPath);\n if (pending) {\n clearTimeout(pending.timer);\n pendingUnlinks.delete(matchedOldPath);\n }\n\n isMove = true;\n appLogger(`File moved from ${matchedOldPath} to ${filePath}`);\n\n await handleContentDeclarationFileMoved(\n matchedOldPath,\n filePath,\n configuration\n );\n }\n\n // If it's NOT a move, perform standard \"New File\" logic\n if (!isMove) {\n const fileContent = await readFile(filePath, 'utf-8');\n const isEmpty = fileContent === '';\n\n // Fill template content declaration file if it is empty\n if (isEmpty) {\n const extensionPattern = fileExtensions\n .map((ext) => ext.replace(/\\./g, '\\\\.'))\n .join('|');\n const name = fileName.replace(\n new RegExp(`(${extensionPattern})$`),\n ''\n );\n\n await writeContentDeclaration(\n {\n key: name,\n content: {},\n filePath,\n },\n configuration\n );\n }\n }\n\n // Always ensure the file is processed (both for moves and adds)\n await handleAdditionalContentDeclarationFile(filePath, configuration);\n })\n .on(\n 'change',\n async (filePath) =>\n await handleContentDeclarationFileChange(filePath, configuration)\n )\n .on('unlink', async (filePath) => {\n // Delay unlink processing to see if an 'add' event occurs (indicating a move)\n const timer = setTimeout(async () => {\n // If timer fires, the file was genuinely removed\n pendingUnlinks.delete(filePath);\n await handleUnlinkedContentDeclarationFile(filePath, configuration);\n }, 200); // 200ms window to catch the 'add' event\n\n pendingUnlinks.set(filePath, { timer, oldPath: filePath });\n })\n .on('error', async (error) => {\n appLogger(`Watcher error: ${error}`, {\n level: 'error',\n });\n\n appLogger('Restarting watcher');\n\n await prepareIntlayer(configuration);\n });\n};\n\nexport const buildAndWatchIntlayer = async (options?: WatchOptions) => {\n const { skipPrepare, ...rest } = options ?? {};\n const configuration =\n options?.configuration ?? getConfiguration(options?.configOptions);\n\n if (!skipPrepare) {\n await prepareIntlayer(configuration, { forceRun: true });\n }\n\n if (configuration.content.watch || options?.persistent) {\n const appLogger = getAppLogger(configuration);\n\n appLogger('Watching Intlayer content declarations');\n watch({ ...rest, configuration });\n }\n};\n"],"mappings":"4vBAkBA,MAAM,EAAiB,IAAI,IAYd,EAAS,GAA2B,CAC/C,IAAM,EACJ,GAAS,eAAiB,EAAiB,GAAS,cAAc,CAC9D,EAAY,EAAa,EAAc,CAEvC,CACJ,MAAO,EACP,8BACA,kBACE,EAAc,QAElB,OAAOA,EAAc,EAA6B,CAChD,WAAY,EACZ,cAAe,GACf,iBAAkB,CAChB,mBAAoB,IACpB,aAAc,IACf,CACD,QAAS,CACP,qBACA,aACA,cACA,kBACD,CACD,GAAG,EACJ,CAAC,CACC,GAAG,MAAO,KAAO,IAAa,CAC7B,IAAM,EAAW,EAAS,EAAS,CAC/B,EAAS,GAMT,EAGJ,IAAK,GAAM,CAAC,KAAY,EACtB,GAAI,EAAS,EAAQ,GAAK,EAAU,CAClC,EAAiB,EACjB,MASJ,GAJI,CAAC,GAAkB,EAAe,OAAS,IAC7C,EAAiB,EAAe,MAAM,CAAC,MAAM,CAAC,OAG5C,EAAgB,CAElB,IAAM,EAAU,EAAe,IAAI,EAAe,CAC9C,IACF,aAAa,EAAQ,MAAM,CAC3B,EAAe,OAAO,EAAe,EAGvC,EAAS,GACT,EAAU,mBAAmB,EAAe,MAAM,IAAW,CAE7D,MAAM,EACJ,EACA,EACA,EACD,CAIH,GAAI,CAAC,GACiB,MAAM,EAAS,EAAU,QAAQ,GACrB,GAGnB,CACX,IAAM,EAAmB,EACtB,IAAK,GAAQ,EAAI,QAAQ,MAAO,MAAM,CAAC,CACvC,KAAK,IAAI,CAMZ,MAAM,EACJ,CACE,IAPS,EAAS,QAChB,OAAO,IAAI,EAAiB,IAAI,CACpC,GACD,CAKG,QAAS,EAAE,CACX,WACD,CACD,EACD,CAKL,MAAM,EAAuC,EAAU,EAAc,EACrE,CACD,GACC,SACA,KAAO,IACL,MAAM,EAAmC,EAAU,EAAc,CACpE,CACA,GAAG,SAAU,KAAO,IAAa,CAEhC,IAAM,EAAQ,WAAW,SAAY,CAEnC,EAAe,OAAO,EAAS,CAC/B,MAAM,EAAqC,EAAU,EAAc,EAClE,IAAI,CAEP,EAAe,IAAI,EAAU,CAAE,QAAO,QAAS,EAAU,CAAC,EAC1D,CACD,GAAG,QAAS,KAAO,IAAU,CAC5B,EAAU,kBAAkB,IAAS,CACnC,MAAO,QACR,CAAC,CAEF,EAAU,qBAAqB,CAE/B,MAAM,EAAgB,EAAc,EACpC,EAGO,EAAwB,KAAO,IAA2B,CACrE,GAAM,CAAE,cAAa,GAAG,GAAS,GAAW,EAAE,CACxC,EACJ,GAAS,eAAiB,EAAiB,GAAS,cAAc,CAE/D,GACH,MAAM,EAAgB,EAAe,CAAE,SAAU,GAAM,CAAC,EAGtD,EAAc,QAAQ,OAAS,GAAS,cACxB,EAAa,EAAc,CAEnC,yCAAyC,CACnD,EAAM,CAAE,GAAG,EAAM,gBAAe,CAAC"}
|
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { mkdir, readFile } from "node:fs/promises";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { isDeepStrictEqual } from "node:util";
|
|
5
|
-
|
|
6
|
-
//#region src/writeConfiguration/index.ts
|
|
7
|
-
const getCachedConfiguration = async (configuration) => {
|
|
8
|
-
const configurationContent = await readFile(join(configuration.system.configDir, "configuration.json"), "utf8");
|
|
9
|
-
return JSON.parse(configurationContent);
|
|
10
|
-
};
|
|
11
|
-
const isCachedConfigurationUpToDate = async (configuration) => {
|
|
12
|
-
try {
|
|
13
|
-
const cleanedConfiguration = cleanConfiguration(configuration);
|
|
14
|
-
return isDeepStrictEqual(await getCachedConfiguration(cleanedConfiguration), cleanedConfiguration);
|
|
15
|
-
} catch {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const cleanConfiguration = (configuration) => {
|
|
20
|
-
const { schemas, plugins, compiler, build, ...filteredConfiguration } = configuration;
|
|
21
|
-
return JSON.parse(JSON.stringify(filteredConfiguration));
|
|
22
|
-
};
|
|
23
|
-
const writeConfiguration = async (configuration) => {
|
|
24
|
-
const { system } = configuration;
|
|
25
|
-
const { configDir } = system;
|
|
26
|
-
await mkdir(configDir, { recursive: true });
|
|
27
|
-
await writeJsonIfChanged(join(configDir, "configuration.json"), cleanConfiguration(configuration));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
export { isCachedConfigurationUpToDate, writeConfiguration };
|
|
1
|
+
import{writeJsonIfChanged as e}from"../writeJsonIfChanged.mjs";import{mkdir as t,readFile as n}from"node:fs/promises";import{join as r}from"node:path";import{isDeepStrictEqual as i}from"node:util";const a=async e=>{let t=await n(r(e.system.configDir,`configuration.json`),`utf8`);return JSON.parse(t)},o=async e=>{try{let t=s(e);return i(await a(t),t)}catch{return null}},s=e=>{let{schemas:t,plugins:n,compiler:r,build:i,...a}=e;return JSON.parse(JSON.stringify(a))},c=async n=>{let{system:i}=n,{configDir:a}=i;await t(a,{recursive:!0}),await e(r(a,`configuration.json`),s(n))};export{o as isCachedConfigurationUpToDate,c as writeConfiguration};
|
|
32
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/writeConfiguration/index.ts"],"sourcesContent":["import { mkdir, readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { isDeepStrictEqual } from 'node:util';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { writeJsonIfChanged } from '../writeJsonIfChanged';\n\nconst getCachedConfiguration = async (configuration: IntlayerConfig) => {\n const configFilePath = join(\n configuration.system.configDir,\n 'configuration.json'\n );\n\n const configurationContent = await readFile(configFilePath, 'utf8');\n return JSON.parse(configurationContent);\n};\n\nexport const isCachedConfigurationUpToDate = async (\n configuration: IntlayerConfig\n): Promise<boolean | null> => {\n try {\n const cleanedConfiguration = cleanConfiguration(configuration);\n const cachedConfiguration =\n await getCachedConfiguration(cleanedConfiguration);\n\n const isSimilar = isDeepStrictEqual(\n cachedConfiguration,\n cleanedConfiguration\n );\n\n return isSimilar;\n } catch {\n return null;\n }\n};\n\nconst cleanConfiguration = (configuration: IntlayerConfig): IntlayerConfig => {\n const {\n // Remove schema, and plugins because only useful at build time\n schemas,\n plugins,\n compiler,\n build,\n ...filteredConfiguration\n } = configuration;\n\n const parsedConfiguration = JSON.parse(JSON.stringify(filteredConfiguration));\n\n return parsedConfiguration;\n};\n\nexport const writeConfiguration = async (configuration: IntlayerConfig) => {\n const { system } = configuration;\n const { configDir } = system;\n\n // Ensure target directory exists\n // configDir is expected to be the directory where configuration.json will live\n await mkdir(configDir, { recursive: true });\n\n const configFilePath = join(configDir, 'configuration.json');\n\n const cleanedConfiguration = cleanConfiguration(configuration);\n\n await writeJsonIfChanged(configFilePath, cleanedConfiguration);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/writeConfiguration/index.ts"],"sourcesContent":["import { mkdir, readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { isDeepStrictEqual } from 'node:util';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { writeJsonIfChanged } from '../writeJsonIfChanged';\n\nconst getCachedConfiguration = async (configuration: IntlayerConfig) => {\n const configFilePath = join(\n configuration.system.configDir,\n 'configuration.json'\n );\n\n const configurationContent = await readFile(configFilePath, 'utf8');\n return JSON.parse(configurationContent);\n};\n\nexport const isCachedConfigurationUpToDate = async (\n configuration: IntlayerConfig\n): Promise<boolean | null> => {\n try {\n const cleanedConfiguration = cleanConfiguration(configuration);\n const cachedConfiguration =\n await getCachedConfiguration(cleanedConfiguration);\n\n const isSimilar = isDeepStrictEqual(\n cachedConfiguration,\n cleanedConfiguration\n );\n\n return isSimilar;\n } catch {\n return null;\n }\n};\n\nconst cleanConfiguration = (configuration: IntlayerConfig): IntlayerConfig => {\n const {\n // Remove schema, and plugins because only useful at build time\n schemas,\n plugins,\n compiler,\n build,\n ...filteredConfiguration\n } = configuration;\n\n const parsedConfiguration = JSON.parse(JSON.stringify(filteredConfiguration));\n\n return parsedConfiguration;\n};\n\nexport const writeConfiguration = async (configuration: IntlayerConfig) => {\n const { system } = configuration;\n const { configDir } = system;\n\n // Ensure target directory exists\n // configDir is expected to be the directory where configuration.json will live\n await mkdir(configDir, { recursive: true });\n\n const configFilePath = join(configDir, 'configuration.json');\n\n const cleanedConfiguration = cleanConfiguration(configuration);\n\n await writeJsonIfChanged(configFilePath, cleanedConfiguration);\n};\n"],"mappings":"qMAMA,MAAM,EAAyB,KAAO,IAAkC,CAMtE,IAAM,EAAuB,MAAM,EALZ,EACrB,EAAc,OAAO,UACrB,qBACD,CAE2D,OAAO,CACnE,OAAO,KAAK,MAAM,EAAqB,EAG5B,EAAgC,KAC3C,IAC4B,CAC5B,GAAI,CACF,IAAM,EAAuB,EAAmB,EAAc,CAS9D,OALkB,EAFhB,MAAM,EAAuB,EAAqB,CAIlD,EACD,MAGK,CACN,OAAO,OAIL,EAAsB,GAAkD,CAC5E,GAAM,CAEJ,UACA,UACA,WACA,QACA,GAAG,GACD,EAIJ,OAF4B,KAAK,MAAM,KAAK,UAAU,EAAsB,CAAC,EAKlE,EAAqB,KAAO,IAAkC,CACzE,GAAM,CAAE,UAAW,EACb,CAAE,aAAc,EAItB,MAAM,EAAM,EAAW,CAAE,UAAW,GAAM,CAAC,CAM3C,MAAM,EAJiB,EAAK,EAAW,qBAAqB,CAE/B,EAAmB,EAAc,CAEA"}
|
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
*/
|
|
9
|
-
const detectExportedComponentName = (fileText) => {
|
|
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;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
export { detectExportedComponentName };
|
|
1
|
+
const e=e=>{let t=/export\s+default\s+function\s+(\w+)/,n=/export\s+default\s+(\w+)/,r=/module\.exports\s*=\s*(\w+)/,i=/exports\.default\s*=\s*(\w+)/,a=/export\s+(?:const|function)\s+(\w+)/g,o=e.match(t);if(o)return o[1];let s=e.match(n);if(s)return s[1];let c=e.match(r)||e.match(i);if(c)return c[1];for(let t of e.matchAll(a))if(/^[A-Z]/.test(t[1]))return t[1];return null};export{e as detectExportedComponentName};
|
|
27
2
|
//# sourceMappingURL=detectExportedComponentName.mjs.map
|
|
@@ -1 +1 @@
|
|
|
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 // 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 // Check for default CJS\n const cjsDefaultMatch =\n fileText.match(cjsDefaultRegex) || fileText.match(cjsDefaultVarRegex);\n\n if (cjsDefaultMatch) return cjsDefaultMatch[1];\n\n // 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":"
|
|
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 // 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 // Check for default CJS\n const cjsDefaultMatch =\n fileText.match(cjsDefaultRegex) || fileText.match(cjsDefaultVarRegex);\n\n if (cjsDefaultMatch) return cjsDefaultMatch[1];\n\n // 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,EACX,GACkB,CAElB,IAAM,EAAoB,sCACpB,EAAqB,2BACrB,EAAkB,8BAClB,EAAqB,+BACrB,EAAmB,uCAGnB,EAAoB,EAAS,MAAM,EAAkB,CAC3D,GAAI,EACF,OAAO,EAAkB,GAG3B,IAAM,EAAqB,EAAS,MAAM,EAAmB,CAC7D,GAAI,EACF,OAAO,EAAmB,GAI5B,IAAM,EACJ,EAAS,MAAM,EAAgB,EAAI,EAAS,MAAM,EAAmB,CAEvE,GAAI,EAAiB,OAAO,EAAgB,GAG5C,IAAK,IAAM,KAAS,EAAS,SAAS,EAAiB,CACrD,GAAI,SAAS,KAAK,EAAM,GAAG,CAAE,OAAO,EAAM,GAI5C,OAAO"}
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//#region src/writeContentDeclaration/detectFormatCommand.ts
|
|
4
|
-
let cachedFormatCommand = null;
|
|
5
|
-
const detectFormatCommand = (configuration, projectRequireProp) => {
|
|
6
|
-
const { formatCommand, baseDir } = configuration.content;
|
|
7
|
-
const projectRequire = projectRequireProp ?? getProjectRequire(baseDir);
|
|
8
|
-
if (formatCommand) return formatCommand;
|
|
9
|
-
if (cachedFormatCommand !== null) return cachedFormatCommand;
|
|
10
|
-
try {
|
|
11
|
-
projectRequire.resolve("prettier");
|
|
12
|
-
cachedFormatCommand = "prettier --write \"{{file}}\" --log-level silent";
|
|
13
|
-
return cachedFormatCommand;
|
|
14
|
-
} catch (_error) {}
|
|
15
|
-
try {
|
|
16
|
-
projectRequire.resolve("biome");
|
|
17
|
-
cachedFormatCommand = "biome format \"{{file}}\" --write --log-level none";
|
|
18
|
-
return cachedFormatCommand;
|
|
19
|
-
} catch (_error) {}
|
|
20
|
-
try {
|
|
21
|
-
projectRequire.resolve("eslint");
|
|
22
|
-
cachedFormatCommand = "eslint --fix \"{{file}}\" --quiet";
|
|
23
|
-
return cachedFormatCommand;
|
|
24
|
-
} catch (_error) {}
|
|
25
|
-
cachedFormatCommand = void 0;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
export { detectFormatCommand };
|
|
1
|
+
import{getProjectRequire as e}from"@intlayer/config/utils";let t=null;const n=(n,r)=>{let{formatCommand:i,baseDir:a}=n.content,o=r??e(a);if(i)return i;if(t!==null)return t;try{return o.resolve(`prettier`),t=`prettier --write "{{file}}" --log-level silent`,t}catch{}try{return o.resolve(`biome`),t=`biome format "{{file}}" --write --log-level none`,t}catch{}try{return o.resolve(`eslint`),t=`eslint --fix "{{file}}" --quiet`,t}catch{}t=void 0};export{n as detectFormatCommand};
|
|
30
2
|
//# sourceMappingURL=detectFormatCommand.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detectFormatCommand.mjs","names":[],"sources":["../../../src/writeContentDeclaration/detectFormatCommand.ts"],"sourcesContent":["import { getProjectRequire } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nlet cachedFormatCommand: string | undefined | null = null;\n\nexport const detectFormatCommand = (\n configuration: IntlayerConfig,\n projectRequireProp?: NodeJS.Require\n) => {\n const { formatCommand, baseDir } = configuration.content;\n const projectRequire = projectRequireProp ?? getProjectRequire(baseDir);\n\n // Priority: Explicit configuration\n // We do not cache this because the user might change their config file active-session.\n if (formatCommand) {\n return formatCommand;\n }\n\n // Priority: Cached detection\n // If not null, we have already performed the expensive checks.\n if (cachedFormatCommand !== null) {\n return cachedFormatCommand;\n }\n\n // Perform Detection\n\n // Try Prettier\n try {\n projectRequire.resolve('prettier');\n cachedFormatCommand = 'prettier --write \"{{file}}\" --log-level silent';\n return cachedFormatCommand;\n } catch (_error) {\n // Prettier not found, continue\n }\n\n // Try Biome\n try {\n projectRequire.resolve('biome');\n cachedFormatCommand = 'biome format \"{{file}}\" --write --log-level none';\n return cachedFormatCommand;\n } catch (_error) {\n // Biome not found, continue\n }\n\n // Try ESLint\n try {\n projectRequire.resolve('eslint');\n cachedFormatCommand = 'eslint --fix \"{{file}}\" --quiet';\n return cachedFormatCommand;\n } catch (_error) {\n // ESLint not found\n }\n\n // No formatter found\n // Set to undefined (not null) so we know we checked and found nothing.\n cachedFormatCommand = undefined;\n return undefined;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"detectFormatCommand.mjs","names":[],"sources":["../../../src/writeContentDeclaration/detectFormatCommand.ts"],"sourcesContent":["import { getProjectRequire } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\n\nlet cachedFormatCommand: string | undefined | null = null;\n\nexport const detectFormatCommand = (\n configuration: IntlayerConfig,\n projectRequireProp?: NodeJS.Require\n) => {\n const { formatCommand, baseDir } = configuration.content;\n const projectRequire = projectRequireProp ?? getProjectRequire(baseDir);\n\n // Priority: Explicit configuration\n // We do not cache this because the user might change their config file active-session.\n if (formatCommand) {\n return formatCommand;\n }\n\n // Priority: Cached detection\n // If not null, we have already performed the expensive checks.\n if (cachedFormatCommand !== null) {\n return cachedFormatCommand;\n }\n\n // Perform Detection\n\n // Try Prettier\n try {\n projectRequire.resolve('prettier');\n cachedFormatCommand = 'prettier --write \"{{file}}\" --log-level silent';\n return cachedFormatCommand;\n } catch (_error) {\n // Prettier not found, continue\n }\n\n // Try Biome\n try {\n projectRequire.resolve('biome');\n cachedFormatCommand = 'biome format \"{{file}}\" --write --log-level none';\n return cachedFormatCommand;\n } catch (_error) {\n // Biome not found, continue\n }\n\n // Try ESLint\n try {\n projectRequire.resolve('eslint');\n cachedFormatCommand = 'eslint --fix \"{{file}}\" --quiet';\n return cachedFormatCommand;\n } catch (_error) {\n // ESLint not found\n }\n\n // No formatter found\n // Set to undefined (not null) so we know we checked and found nothing.\n cachedFormatCommand = undefined;\n return undefined;\n};\n"],"mappings":"2DAGA,IAAI,EAAiD,KAErD,MAAa,GACX,EACA,IACG,CACH,GAAM,CAAE,gBAAe,WAAY,EAAc,QAC3C,EAAiB,GAAsB,EAAkB,EAAQ,CAIvE,GAAI,EACF,OAAO,EAKT,GAAI,IAAwB,KAC1B,OAAO,EAMT,GAAI,CAGF,OAFA,EAAe,QAAQ,WAAW,CAClC,EAAsB,iDACf,OACQ,EAKjB,GAAI,CAGF,OAFA,EAAe,QAAQ,QAAQ,CAC/B,EAAsB,mDACf,OACQ,EAKjB,GAAI,CAGF,OAFA,EAAe,QAAQ,SAAS,CAChC,EAAsB,kCACf,OACQ,EAMjB,EAAsB,IAAA"}
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { detectFormatCommand } from "./detectFormatCommand.mjs";
|
|
3
|
-
import { transformJSFile } from "./transformJSFile.mjs";
|
|
4
|
-
import { writeJSFile } from "./writeJSFile.mjs";
|
|
5
|
-
import { writeContentDeclaration } from "./writeContentDeclaration.mjs";
|
|
6
|
-
|
|
7
|
-
export { detectExportedComponentName, detectFormatCommand, transformJSFile, writeContentDeclaration, writeJSFile };
|
|
1
|
+
import{detectExportedComponentName as e}from"./detectExportedComponentName.mjs";import{detectFormatCommand as t}from"./detectFormatCommand.mjs";import{transformJSFile as n}from"./transformJSFile.mjs";import{writeJSFile as r}from"./writeJSFile.mjs";import{writeContentDeclaration as i}from"./writeContentDeclaration.mjs";export{e as detectExportedComponentName,t as detectFormatCommand,n as transformJSFile,i as writeContentDeclaration,r as writeJSFile};
|
|
@@ -1,92 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { deepTransformNode } from "@intlayer/core";
|
|
4
|
-
import { NodeType } from "@intlayer/types";
|
|
5
|
-
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
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) => {
|
|
40
|
-
return {
|
|
41
|
-
nodeType: NodeType.Markdown,
|
|
42
|
-
[NodeType.Markdown]: deepTransformNode(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) => {
|
|
53
|
-
return {
|
|
54
|
-
nodeType: NodeType.Insertion,
|
|
55
|
-
[NodeType.Insertion]: deepTransformNode(node.insertion, props)
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* HTML file plugin
|
|
61
|
-
*/
|
|
62
|
-
const htmlFilePlugin = {
|
|
63
|
-
id: "html-file-plugin",
|
|
64
|
-
canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.HTML,
|
|
65
|
-
transform: (node, props, deepTransformNode) => {
|
|
66
|
-
return {
|
|
67
|
-
nodeType: NodeType.HTML,
|
|
68
|
-
[NodeType.HTML]: deepTransformNode(node.html, props)
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Process content declaration content
|
|
74
|
-
*
|
|
75
|
-
* It filter node that are autogenerated by intlayer to do not rewrite them in the content declaration file.
|
|
76
|
-
*
|
|
77
|
-
* And write external sources as file content if necessary.
|
|
78
|
-
*/
|
|
79
|
-
const processContentDeclarationContent = async (dictionary) => deepTransformNode(dictionary, {
|
|
80
|
-
dictionaryKey: dictionary.key,
|
|
81
|
-
keyPath: [],
|
|
82
|
-
plugins: [
|
|
83
|
-
writeFilePlugin,
|
|
84
|
-
markdownFilePlugin,
|
|
85
|
-
insertionFilePlugin,
|
|
86
|
-
htmlFilePlugin
|
|
87
|
-
]
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
//#endregion
|
|
91
|
-
export { processContentDeclarationContent };
|
|
1
|
+
import{dirname as e,join as t}from"node:path";import{colorizePath as n,x as r}from"@intlayer/config/logger";import{deepTransformNode as i}from"@intlayer/core/interpreter";import{NodeType as a}from"@intlayer/types";import{existsSync as o,mkdirSync as s,writeFileSync as c}from"node:fs";const l={id:`write-file-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===a.File,transform:i=>{let l=i.content,u=i.fixedPath;if(typeof l!=`string`)throw Error(`File content must be a string`);if(typeof u!=`string`)throw Error(`File path must be a string`);try{let n=t(process.cwd(),u),r=e(n);o(r)||s(r,{recursive:!0}),c(n,l)}catch(e){throw Error(`${r} Error writing file to ${n(u)}: ${e}`)}return{nodeType:a.File,[a.File]:i.file}}},u={id:`markdown-file-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===a.Markdown,transform:(e,t,n)=>({nodeType:a.Markdown,[a.Markdown]:n(e.markdown,t)})},d={id:`insertion-file-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===a.Insertion,transform:(e,t,n)=>({nodeType:a.Insertion,[a.Insertion]:n(e.insertion,t)})},f={id:`html-file-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===a.HTML,transform:(e,t,n)=>({nodeType:a.HTML,[a.HTML]:n(e.html,t)})},p=async e=>i(e,{dictionaryKey:e.key,keyPath:[],plugins:[l,u,d,f]});export{p as processContentDeclarationContent};
|
|
92
2
|
//# sourceMappingURL=processContentDeclarationContent.mjs.map
|