@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,155 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let node_stream = require("node:stream");
|
|
4
|
-
|
|
5
|
-
//#region src/utils/runParallel/runTask.ts
|
|
6
|
-
/**
|
|
7
|
-
* Remove the given value from the array.
|
|
8
|
-
*/
|
|
9
|
-
const remove = (array, x) => {
|
|
10
|
-
const index = array.indexOf(x);
|
|
11
|
-
if (index !== -1) array.splice(index, 1);
|
|
12
|
-
};
|
|
13
|
-
const signals = {
|
|
14
|
-
SIGABRT: 6,
|
|
15
|
-
SIGALRM: 14,
|
|
16
|
-
SIGBUS: 10,
|
|
17
|
-
SIGCHLD: 20,
|
|
18
|
-
SIGCONT: 19,
|
|
19
|
-
SIGFPE: 8,
|
|
20
|
-
SIGHUP: 1,
|
|
21
|
-
SIGILL: 4,
|
|
22
|
-
SIGINT: 2,
|
|
23
|
-
SIGKILL: 9,
|
|
24
|
-
SIGPIPE: 13,
|
|
25
|
-
SIGQUIT: 3,
|
|
26
|
-
SIGSEGV: 11,
|
|
27
|
-
SIGSTOP: 17,
|
|
28
|
-
SIGTERM: 15,
|
|
29
|
-
SIGTRAP: 5,
|
|
30
|
-
SIGTSTP: 18,
|
|
31
|
-
SIGTTIN: 21,
|
|
32
|
-
SIGTTOU: 22,
|
|
33
|
-
SIGUSR1: 30,
|
|
34
|
-
SIGUSR2: 31
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Converts a signal name to a number.
|
|
38
|
-
*/
|
|
39
|
-
const convert = (signal) => {
|
|
40
|
-
return signals[signal] || 0;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Simple in-memory writable stream
|
|
44
|
-
*/
|
|
45
|
-
var MemoryStream = class extends node_stream.Writable {
|
|
46
|
-
chunks = [];
|
|
47
|
-
_write(chunk, _encoding, callback) {
|
|
48
|
-
this.chunks.push(chunk);
|
|
49
|
-
callback();
|
|
50
|
-
}
|
|
51
|
-
toString() {
|
|
52
|
-
return Buffer.concat(this.chunks).toString("utf8");
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Run npm-scripts of given names in parallel.
|
|
57
|
-
*
|
|
58
|
-
* If a npm-script exited with a non-zero code, this aborts other all npm-scripts.
|
|
59
|
-
*
|
|
60
|
-
* Note: This is a simplified version for our use case.
|
|
61
|
-
* The full implementation would require the actual runTask function from npm-run-all.
|
|
62
|
-
*/
|
|
63
|
-
const runTasks = (tasks, options) => {
|
|
64
|
-
return new Promise((resolve, reject) => {
|
|
65
|
-
if (tasks.length === 0) {
|
|
66
|
-
resolve([]);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const results = tasks.map((task) => ({
|
|
70
|
-
name: task,
|
|
71
|
-
code: void 0
|
|
72
|
-
}));
|
|
73
|
-
const queue = tasks.map((task, index) => ({
|
|
74
|
-
name: task,
|
|
75
|
-
index
|
|
76
|
-
}));
|
|
77
|
-
const promises = [];
|
|
78
|
-
let error = null;
|
|
79
|
-
let aborted = false;
|
|
80
|
-
/**
|
|
81
|
-
* Done.
|
|
82
|
-
*/
|
|
83
|
-
const done = () => {
|
|
84
|
-
if (error == null) resolve(results);
|
|
85
|
-
else reject(error);
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Aborts all tasks.
|
|
89
|
-
*/
|
|
90
|
-
const abort = () => {
|
|
91
|
-
if (aborted) return;
|
|
92
|
-
aborted = true;
|
|
93
|
-
if (promises.length === 0) done();
|
|
94
|
-
else {
|
|
95
|
-
for (const p of promises) p.abort?.();
|
|
96
|
-
Promise.all(promises).then(done, reject);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Runs a next task.
|
|
101
|
-
*/
|
|
102
|
-
const next = () => {
|
|
103
|
-
if (aborted) return;
|
|
104
|
-
if (queue.length === 0) {
|
|
105
|
-
if (promises.length === 0) done();
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
const originalOutputStream = options.stdout;
|
|
109
|
-
const optionsClone = { ...options };
|
|
110
|
-
const writer = new MemoryStream();
|
|
111
|
-
if (options.aggregateOutput) optionsClone.stdout = writer;
|
|
112
|
-
const task = queue.shift();
|
|
113
|
-
const promise = Promise.resolve({
|
|
114
|
-
name: task.name,
|
|
115
|
-
code: 0,
|
|
116
|
-
signal: null
|
|
117
|
-
});
|
|
118
|
-
promises.push(promise);
|
|
119
|
-
promise.then((result) => {
|
|
120
|
-
remove(promises, promise);
|
|
121
|
-
if (aborted) return;
|
|
122
|
-
if (options.aggregateOutput) originalOutputStream.write(writer.toString());
|
|
123
|
-
if (result.code === null && result.signal !== null && result.signal !== void 0) result.code = 128 + convert(result.signal);
|
|
124
|
-
results[task.index].code = result.code;
|
|
125
|
-
if (result.code) {
|
|
126
|
-
error = /* @__PURE__ */ new Error(`Task ${result.name} failed with code ${result.code}`);
|
|
127
|
-
if (!options.continueOnError) {
|
|
128
|
-
abort();
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (options.race && !result.code) {
|
|
133
|
-
abort();
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
next();
|
|
137
|
-
}, (thisError) => {
|
|
138
|
-
remove(promises, promise);
|
|
139
|
-
if (!options.continueOnError || options.race) {
|
|
140
|
-
error = thisError;
|
|
141
|
-
abort();
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
next();
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
const max = options.maxParallel;
|
|
148
|
-
const end = typeof max === "number" && max > 0 ? Math.min(tasks.length, max) : tasks.length;
|
|
149
|
-
for (let i = 0; i < end; ++i) next();
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
//#endregion
|
|
154
|
-
exports.runTasks = runTasks;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`node:stream`);const t=(e,t)=>{let n=e.indexOf(t);n!==-1&&e.splice(n,1)},n={SIGABRT:6,SIGALRM:14,SIGBUS:10,SIGCHLD:20,SIGCONT:19,SIGFPE:8,SIGHUP:1,SIGILL:4,SIGINT:2,SIGKILL:9,SIGPIPE:13,SIGQUIT:3,SIGSEGV:11,SIGSTOP:17,SIGTERM:15,SIGTRAP:5,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGUSR1:30,SIGUSR2:31},r=e=>n[e]||0;var i=class extends e.Writable{chunks=[];_write(e,t,n){this.chunks.push(e),n()}toString(){return Buffer.concat(this.chunks).toString(`utf8`)}};const a=(e,n)=>new Promise((a,o)=>{if(e.length===0){a([]);return}let s=e.map(e=>({name:e,code:void 0})),c=e.map((e,t)=>({name:e,index:t})),l=[],u=null,d=!1,f=()=>{u==null?a(s):o(u)},p=()=>{if(!d)if(d=!0,l.length===0)f();else{for(let e of l)e.abort?.();Promise.all(l).then(f,o)}},m=()=>{if(d)return;if(c.length===0){l.length===0&&f();return}let e=n.stdout,a={...n},o=new i;n.aggregateOutput&&(a.stdout=o);let h=c.shift(),g=Promise.resolve({name:h.name,code:0,signal:null});l.push(g),g.then(i=>{if(t(l,g),!d){if(n.aggregateOutput&&e.write(o.toString()),i.code===null&&i.signal!==null&&i.signal!==void 0&&(i.code=128+r(i.signal)),s[h.index].code=i.code,i.code&&(u=Error(`Task ${i.name} failed with code ${i.code}`),!n.continueOnError)){p();return}if(n.race&&!i.code){p();return}m()}},e=>{if(t(l,g),!n.continueOnError||n.race){u=e,p();return}m()})},h=n.maxParallel,g=typeof h==`number`&&h>0?Math.min(e.length,h):e.length;for(let e=0;e<g;++e)m()});exports.runTasks=a;
|
|
155
2
|
//# sourceMappingURL=runTask.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runTask.cjs","names":["Writable"],"sources":["../../../../src/utils/runParallel/runTask.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport { Writable } from 'node:stream';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Remove the given value from the array.\n */\nconst remove = <T>(array: T[], x: T): void => {\n const index = array.indexOf(x);\n if (index !== -1) {\n array.splice(index, 1);\n }\n};\n\nconst signals: Record<string, number> = {\n // Signal name mappings to their respective standard numeric codes.\n // See: https://man7.org/linux/man-pages/man7/signal.7.html\n\n SIGABRT: 6, // Abort signal from abort(3)\n SIGALRM: 14, // Timer signal from alarm(2)\n SIGBUS: 10, // Bus error (bad memory access)\n SIGCHLD: 20, // Child stopped or terminated\n SIGCONT: 19, // Continue if stopped\n SIGFPE: 8, // Floating point exception\n SIGHUP: 1, // Hangup detected on controlling terminal or death of controlling process\n SIGILL: 4, // Illegal Instruction\n SIGINT: 2, // Interrupt from keyboard (Ctrl+C)\n SIGKILL: 9, // Kill signal (cannot be caught or ignored)\n SIGPIPE: 13, // Broken pipe: write to pipe with no readers\n SIGQUIT: 3, // Quit from keyboard (Ctrl+\\)\n SIGSEGV: 11, // Invalid memory reference (segmentation fault)\n SIGSTOP: 17, // Stop process (cannot be caught or ignored)\n SIGTERM: 15, // Termination signal\n SIGTRAP: 5, // Trace/breakpoint trap\n SIGTSTP: 18, // Stop typed at tty (Ctrl+Z)\n SIGTTIN: 21, // tty input for background process\n SIGTTOU: 22, // tty output for background process\n SIGUSR1: 30, // User-defined signal 1\n SIGUSR2: 31, // User-defined signal 2\n};\n\n/**\n * Converts a signal name to a number.\n */\nconst convert = (signal: string): number => {\n return signals[signal] || 0;\n};\n\n/**\n * Simple in-memory writable stream\n */\nclass MemoryStream extends Writable {\n private chunks: Buffer[] = [];\n\n _write(\n chunk: Buffer,\n _encoding: string,\n callback: (error?: Error | null) => void\n ): void {\n this.chunks.push(chunk);\n callback();\n }\n\n toString(): string {\n return Buffer.concat(this.chunks).toString('utf8');\n }\n}\n\n//------------------------------------------------------------------------------\n// Types\n//------------------------------------------------------------------------------\n\ninterface TaskResult {\n name: string;\n code: number | null;\n signal?: string | null;\n}\n\ninterface TaskQueueItem {\n name: string;\n index: number;\n}\n\ninterface RunTaskOptions {\n stdout: NodeJS.WritableStream;\n stderr?: NodeJS.WritableStream;\n aggregateOutput?: boolean;\n continueOnError?: boolean;\n race?: boolean;\n maxParallel?: number;\n}\n\ninterface TaskPromise extends Promise<TaskResult> {\n abort?: () => void;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Run npm-scripts of given names in parallel.\n *\n * If a npm-script exited with a non-zero code, this aborts other all npm-scripts.\n *\n * Note: This is a simplified version for our use case.\n * The full implementation would require the actual runTask function from npm-run-all.\n */\nexport const runTasks = (\n tasks: string[],\n options: RunTaskOptions\n): Promise<TaskResult[]> => {\n return new Promise((resolve, reject) => {\n if (tasks.length === 0) {\n resolve([]);\n return;\n }\n\n const results: TaskResult[] = tasks.map((task) => ({\n name: task,\n code: undefined as any,\n }));\n const queue: TaskQueueItem[] = tasks.map((task, index) => ({\n name: task,\n index,\n }));\n const promises: TaskPromise[] = [];\n let error: Error | null = null;\n let aborted = false;\n\n /**\n * Done.\n */\n const done = (): void => {\n if (error == null) {\n resolve(results);\n } else {\n reject(error);\n }\n };\n\n /**\n * Aborts all tasks.\n */\n const abort = (): void => {\n if (aborted) {\n return;\n }\n aborted = true;\n\n if (promises.length === 0) {\n done();\n } else {\n for (const p of promises) {\n p.abort?.();\n }\n Promise.all(promises).then(done, reject);\n }\n };\n\n /**\n * Runs a next task.\n */\n const next = (): void => {\n if (aborted) {\n return;\n }\n if (queue.length === 0) {\n if (promises.length === 0) {\n done();\n }\n return;\n }\n\n const originalOutputStream = options.stdout;\n const optionsClone = { ...options };\n const writer = new MemoryStream();\n\n if (options.aggregateOutput) {\n optionsClone.stdout = writer as any;\n }\n\n const task = queue.shift()!;\n\n // Note: This requires the actual runTask implementation from npm-run-all\n // For now, this is a placeholder that would need to be implemented\n const promise = Promise.resolve({\n name: task.name,\n code: 0,\n signal: null,\n }) as TaskPromise;\n\n promises.push(promise);\n promise.then(\n (result) => {\n remove(promises, promise);\n if (aborted) {\n return;\n }\n\n if (options.aggregateOutput) {\n originalOutputStream.write(writer.toString());\n }\n\n // Check if the task failed as a result of a signal, and\n // amend the exit code as a result.\n if (\n result.code === null &&\n result.signal !== null &&\n result.signal !== undefined\n ) {\n // An exit caused by a signal must return a status code\n // of 128 plus the value of the signal code.\n // Ref: https://nodejs.org/api/process.html#process_exit_codes\n result.code = 128 + convert(result.signal);\n }\n\n // Save the result.\n results[task.index].code = result.code;\n\n // Aborts all tasks if it's an error.\n if (result.code) {\n error = new Error(\n `Task ${result.name} failed with code ${result.code}`\n );\n if (!options.continueOnError) {\n abort();\n return;\n }\n }\n\n // Aborts all tasks if options.race is true.\n if (options.race && !result.code) {\n abort();\n return;\n }\n\n // Call the next task.\n next();\n },\n (thisError: Error) => {\n remove(promises, promise);\n if (!options.continueOnError || options.race) {\n error = thisError;\n abort();\n return;\n }\n next();\n }\n );\n };\n\n const max = options.maxParallel;\n const end =\n typeof max === 'number' && max > 0\n ? Math.min(tasks.length, max)\n : tasks.length;\n for (let i = 0; i < end; ++i) {\n next();\n }\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runTask.cjs","names":["Writable"],"sources":["../../../../src/utils/runParallel/runTask.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport { Writable } from 'node:stream';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Remove the given value from the array.\n */\nconst remove = <T>(array: T[], x: T): void => {\n const index = array.indexOf(x);\n if (index !== -1) {\n array.splice(index, 1);\n }\n};\n\nconst signals: Record<string, number> = {\n // Signal name mappings to their respective standard numeric codes.\n // See: https://man7.org/linux/man-pages/man7/signal.7.html\n\n SIGABRT: 6, // Abort signal from abort(3)\n SIGALRM: 14, // Timer signal from alarm(2)\n SIGBUS: 10, // Bus error (bad memory access)\n SIGCHLD: 20, // Child stopped or terminated\n SIGCONT: 19, // Continue if stopped\n SIGFPE: 8, // Floating point exception\n SIGHUP: 1, // Hangup detected on controlling terminal or death of controlling process\n SIGILL: 4, // Illegal Instruction\n SIGINT: 2, // Interrupt from keyboard (Ctrl+C)\n SIGKILL: 9, // Kill signal (cannot be caught or ignored)\n SIGPIPE: 13, // Broken pipe: write to pipe with no readers\n SIGQUIT: 3, // Quit from keyboard (Ctrl+\\)\n SIGSEGV: 11, // Invalid memory reference (segmentation fault)\n SIGSTOP: 17, // Stop process (cannot be caught or ignored)\n SIGTERM: 15, // Termination signal\n SIGTRAP: 5, // Trace/breakpoint trap\n SIGTSTP: 18, // Stop typed at tty (Ctrl+Z)\n SIGTTIN: 21, // tty input for background process\n SIGTTOU: 22, // tty output for background process\n SIGUSR1: 30, // User-defined signal 1\n SIGUSR2: 31, // User-defined signal 2\n};\n\n/**\n * Converts a signal name to a number.\n */\nconst convert = (signal: string): number => {\n return signals[signal] || 0;\n};\n\n/**\n * Simple in-memory writable stream\n */\nclass MemoryStream extends Writable {\n private chunks: Buffer[] = [];\n\n _write(\n chunk: Buffer,\n _encoding: string,\n callback: (error?: Error | null) => void\n ): void {\n this.chunks.push(chunk);\n callback();\n }\n\n toString(): string {\n return Buffer.concat(this.chunks).toString('utf8');\n }\n}\n\n//------------------------------------------------------------------------------\n// Types\n//------------------------------------------------------------------------------\n\ninterface TaskResult {\n name: string;\n code: number | null;\n signal?: string | null;\n}\n\ninterface TaskQueueItem {\n name: string;\n index: number;\n}\n\ninterface RunTaskOptions {\n stdout: NodeJS.WritableStream;\n stderr?: NodeJS.WritableStream;\n aggregateOutput?: boolean;\n continueOnError?: boolean;\n race?: boolean;\n maxParallel?: number;\n}\n\ninterface TaskPromise extends Promise<TaskResult> {\n abort?: () => void;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Run npm-scripts of given names in parallel.\n *\n * If a npm-script exited with a non-zero code, this aborts other all npm-scripts.\n *\n * Note: This is a simplified version for our use case.\n * The full implementation would require the actual runTask function from npm-run-all.\n */\nexport const runTasks = (\n tasks: string[],\n options: RunTaskOptions\n): Promise<TaskResult[]> => {\n return new Promise((resolve, reject) => {\n if (tasks.length === 0) {\n resolve([]);\n return;\n }\n\n const results: TaskResult[] = tasks.map((task) => ({\n name: task,\n code: undefined as any,\n }));\n const queue: TaskQueueItem[] = tasks.map((task, index) => ({\n name: task,\n index,\n }));\n const promises: TaskPromise[] = [];\n let error: Error | null = null;\n let aborted = false;\n\n /**\n * Done.\n */\n const done = (): void => {\n if (error == null) {\n resolve(results);\n } else {\n reject(error);\n }\n };\n\n /**\n * Aborts all tasks.\n */\n const abort = (): void => {\n if (aborted) {\n return;\n }\n aborted = true;\n\n if (promises.length === 0) {\n done();\n } else {\n for (const p of promises) {\n p.abort?.();\n }\n Promise.all(promises).then(done, reject);\n }\n };\n\n /**\n * Runs a next task.\n */\n const next = (): void => {\n if (aborted) {\n return;\n }\n if (queue.length === 0) {\n if (promises.length === 0) {\n done();\n }\n return;\n }\n\n const originalOutputStream = options.stdout;\n const optionsClone = { ...options };\n const writer = new MemoryStream();\n\n if (options.aggregateOutput) {\n optionsClone.stdout = writer as any;\n }\n\n const task = queue.shift()!;\n\n // Note: This requires the actual runTask implementation from npm-run-all\n // For now, this is a placeholder that would need to be implemented\n const promise = Promise.resolve({\n name: task.name,\n code: 0,\n signal: null,\n }) as TaskPromise;\n\n promises.push(promise);\n promise.then(\n (result) => {\n remove(promises, promise);\n if (aborted) {\n return;\n }\n\n if (options.aggregateOutput) {\n originalOutputStream.write(writer.toString());\n }\n\n // Check if the task failed as a result of a signal, and\n // amend the exit code as a result.\n if (\n result.code === null &&\n result.signal !== null &&\n result.signal !== undefined\n ) {\n // An exit caused by a signal must return a status code\n // of 128 plus the value of the signal code.\n // Ref: https://nodejs.org/api/process.html#process_exit_codes\n result.code = 128 + convert(result.signal);\n }\n\n // Save the result.\n results[task.index].code = result.code;\n\n // Aborts all tasks if it's an error.\n if (result.code) {\n error = new Error(\n `Task ${result.name} failed with code ${result.code}`\n );\n if (!options.continueOnError) {\n abort();\n return;\n }\n }\n\n // Aborts all tasks if options.race is true.\n if (options.race && !result.code) {\n abort();\n return;\n }\n\n // Call the next task.\n next();\n },\n (thisError: Error) => {\n remove(promises, promise);\n if (!options.continueOnError || options.race) {\n error = thisError;\n abort();\n return;\n }\n next();\n }\n );\n };\n\n const max = options.maxParallel;\n const end =\n typeof max === 'number' && max > 0\n ? Math.min(tasks.length, max)\n : tasks.length;\n for (let i = 0; i < end; ++i) {\n next();\n }\n });\n};\n"],"mappings":"gJAaA,MAAM,GAAa,EAAY,IAAe,CAC5C,IAAM,EAAQ,EAAM,QAAQ,EAAE,CAC1B,IAAU,IACZ,EAAM,OAAO,EAAO,EAAE,EAIpB,EAAkC,CAItC,QAAS,EACT,QAAS,GACT,OAAQ,GACR,QAAS,GACT,QAAS,GACT,OAAQ,EACR,OAAQ,EACR,OAAQ,EACR,OAAQ,EACR,QAAS,EACT,QAAS,GACT,QAAS,EACT,QAAS,GACT,QAAS,GACT,QAAS,GACT,QAAS,EACT,QAAS,GACT,QAAS,GACT,QAAS,GACT,QAAS,GACT,QAAS,GACV,CAKK,EAAW,GACR,EAAQ,IAAW,EAM5B,IAAM,EAAN,cAA2BA,EAAAA,QAAS,CAClC,OAA2B,EAAE,CAE7B,OACE,EACA,EACA,EACM,CACN,KAAK,OAAO,KAAK,EAAM,CACvB,GAAU,CAGZ,UAAmB,CACjB,OAAO,OAAO,OAAO,KAAK,OAAO,CAAC,SAAS,OAAO,GA4CtD,MAAa,GACX,EACA,IAEO,IAAI,SAAS,EAAS,IAAW,CACtC,GAAI,EAAM,SAAW,EAAG,CACtB,EAAQ,EAAE,CAAC,CACX,OAGF,IAAM,EAAwB,EAAM,IAAK,IAAU,CACjD,KAAM,EACN,KAAM,IAAA,GACP,EAAE,CACG,EAAyB,EAAM,KAAK,EAAM,KAAW,CACzD,KAAM,EACN,QACD,EAAE,CACG,EAA0B,EAAE,CAC9B,EAAsB,KACtB,EAAU,GAKR,MAAmB,CACnB,GAAS,KACX,EAAQ,EAAQ,CAEhB,EAAO,EAAM,EAOX,MAAoB,CACpB,MAKJ,GAFA,EAAU,GAEN,EAAS,SAAW,EACtB,GAAM,KACD,CACL,IAAK,IAAM,KAAK,EACd,EAAE,SAAS,CAEb,QAAQ,IAAI,EAAS,CAAC,KAAK,EAAM,EAAO,GAOtC,MAAmB,CACvB,GAAI,EACF,OAEF,GAAI,EAAM,SAAW,EAAG,CAClB,EAAS,SAAW,GACtB,GAAM,CAER,OAGF,IAAM,EAAuB,EAAQ,OAC/B,EAAe,CAAE,GAAG,EAAS,CAC7B,EAAS,IAAI,EAEf,EAAQ,kBACV,EAAa,OAAS,GAGxB,IAAM,EAAO,EAAM,OAAO,CAIpB,EAAU,QAAQ,QAAQ,CAC9B,KAAM,EAAK,KACX,KAAM,EACN,OAAQ,KACT,CAAC,CAEF,EAAS,KAAK,EAAQ,CACtB,EAAQ,KACL,GAAW,CACV,KAAO,EAAU,EAAQ,CACrB,GAyBJ,IArBI,EAAQ,iBACV,EAAqB,MAAM,EAAO,UAAU,CAAC,CAM7C,EAAO,OAAS,MAChB,EAAO,SAAW,MAClB,EAAO,SAAW,IAAA,KAKlB,EAAO,KAAO,IAAM,EAAQ,EAAO,OAAO,EAI5C,EAAQ,EAAK,OAAO,KAAO,EAAO,KAG9B,EAAO,OACT,EAAY,MACV,QAAQ,EAAO,KAAK,oBAAoB,EAAO,OAChD,CACG,CAAC,EAAQ,iBAAiB,CAC5B,GAAO,CACP,OAKJ,GAAI,EAAQ,MAAQ,CAAC,EAAO,KAAM,CAChC,GAAO,CACP,OAIF,GAAM,GAEP,GAAqB,CAEpB,GADA,EAAO,EAAU,EAAQ,CACrB,CAAC,EAAQ,iBAAmB,EAAQ,KAAM,CAC5C,EAAQ,EACR,GAAO,CACP,OAEF,GAAM,EAET,EAGG,EAAM,EAAQ,YACd,EACJ,OAAO,GAAQ,UAAY,EAAM,EAC7B,KAAK,IAAI,EAAM,OAAQ,EAAI,CAC3B,EAAM,OACZ,IAAK,IAAI,EAAI,EAAG,EAAI,EAAK,EAAE,EACzB,GAAM,EAER"}
|
|
@@ -1,60 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_utils_runParallel_pidTree = require('./pidTree.cjs');
|
|
4
|
-
let node_child_process = require("node:child_process");
|
|
5
|
-
|
|
6
|
-
//#region src/utils/runParallel/spawnPosix.ts
|
|
7
|
-
/**
|
|
8
|
-
* Kills the new process and its sub processes.
|
|
9
|
-
*/
|
|
10
|
-
const createKillHandler = (child) => {
|
|
11
|
-
return (signal) => {
|
|
12
|
-
if (!child.pid) return false;
|
|
13
|
-
try {
|
|
14
|
-
require_utils_runParallel_pidTree.list(child.pid, { root: true }, (err, pids) => {
|
|
15
|
-
if (err) {
|
|
16
|
-
try {
|
|
17
|
-
process.kill(-child.pid, signal ?? "SIGTERM");
|
|
18
|
-
} catch {}
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (!pids) {
|
|
22
|
-
try {
|
|
23
|
-
process.kill(-child.pid, signal ?? "SIGTERM");
|
|
24
|
-
} catch {}
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
for (const pid of pids) try {
|
|
28
|
-
process.kill(pid, signal ?? "SIGTERM");
|
|
29
|
-
} catch (_err) {}
|
|
30
|
-
});
|
|
31
|
-
} catch {
|
|
32
|
-
try {
|
|
33
|
-
process.kill(-child.pid, signal ?? "SIGTERM");
|
|
34
|
-
} catch {}
|
|
35
|
-
}
|
|
36
|
-
return true;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Launches a new process with the given command.
|
|
41
|
-
* This is almost same as `child_process.spawn`.
|
|
42
|
-
*
|
|
43
|
-
* This returns a `ChildProcess` instance.
|
|
44
|
-
* `kill` method of the instance kills the new process and its sub processes.
|
|
45
|
-
*
|
|
46
|
-
* @param command - The command to run.
|
|
47
|
-
* @param args - List of string arguments.
|
|
48
|
-
* @param options - Options.
|
|
49
|
-
* @returns A ChildProcess instance of new process.
|
|
50
|
-
* @private
|
|
51
|
-
*/
|
|
52
|
-
const spawnPosix = (command, args, options) => {
|
|
53
|
-
const child = (0, node_child_process.spawn)(command, args, options);
|
|
54
|
-
child.kill = createKillHandler(child);
|
|
55
|
-
return child;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
//#endregion
|
|
59
|
-
exports.spawnPosix = spawnPosix;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`./pidTree.cjs`);let t=require(`node:child_process`);const n=t=>n=>{if(!t.pid)return!1;try{e.list(t.pid,{root:!0},(e,r)=>{if(e){try{process.kill(-t.pid,n??`SIGTERM`)}catch{}return}if(!r){try{process.kill(-t.pid,n??`SIGTERM`)}catch{}return}for(let e of r)try{process.kill(e,n??`SIGTERM`)}catch{}})}catch{try{process.kill(-t.pid,n??`SIGTERM`)}catch{}}return!0},r=(e,r,i)=>{let a=(0,t.spawn)(e,r,i);return a.kill=n(a),a};exports.spawnPosix=r;
|
|
60
2
|
//# sourceMappingURL=spawnPosix.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawnPosix.cjs","names":[],"sources":["../../../../src/utils/runParallel/spawnPosix.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport { type ChildProcess, spawn as nodeSpawn } from 'node:child_process';\nimport { list } from './pidTree';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes.\n */\nconst createKillHandler = (\n child: ChildProcess\n): ((signal?: NodeJS.Signals | number) => boolean) => {\n return (signal?: NodeJS.Signals | number): boolean => {\n if (!child.pid) return false;\n\n // Try using list if available\n try {\n list(child.pid, { root: true }, (err: Error | null, pids?: number[]) => {\n if (err) {\n // Fallback to process group kill\n try {\n process.kill(-child.pid!, signal ?? 'SIGTERM');\n } catch {\n // ignore\n }\n return;\n }\n\n if (!pids) {\n // Fallback to process group kill if no pids returned\n try {\n process.kill(-child.pid!, signal ?? 'SIGTERM');\n } catch {\n // ignore\n }\n return;\n }\n\n for (const pid of pids) {\n try {\n process.kill(pid, signal ?? 'SIGTERM');\n } catch (_err) {\n // ignore.\n }\n }\n });\n } catch {\n // pidtree not available, use process group kill\n try {\n process.kill(-child.pid, signal ?? 'SIGTERM');\n } catch {\n // ignore\n }\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnPosix = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n const child = nodeSpawn(command, args, options);\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"spawnPosix.cjs","names":[],"sources":["../../../../src/utils/runParallel/spawnPosix.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport { type ChildProcess, spawn as nodeSpawn } from 'node:child_process';\nimport { list } from './pidTree';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes.\n */\nconst createKillHandler = (\n child: ChildProcess\n): ((signal?: NodeJS.Signals | number) => boolean) => {\n return (signal?: NodeJS.Signals | number): boolean => {\n if (!child.pid) return false;\n\n // Try using list if available\n try {\n list(child.pid, { root: true }, (err: Error | null, pids?: number[]) => {\n if (err) {\n // Fallback to process group kill\n try {\n process.kill(-child.pid!, signal ?? 'SIGTERM');\n } catch {\n // ignore\n }\n return;\n }\n\n if (!pids) {\n // Fallback to process group kill if no pids returned\n try {\n process.kill(-child.pid!, signal ?? 'SIGTERM');\n } catch {\n // ignore\n }\n return;\n }\n\n for (const pid of pids) {\n try {\n process.kill(pid, signal ?? 'SIGTERM');\n } catch (_err) {\n // ignore.\n }\n }\n });\n } catch {\n // pidtree not available, use process group kill\n try {\n process.kill(-child.pid, signal ?? 'SIGTERM');\n } catch {\n // ignore\n }\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnPosix = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n const child = nodeSpawn(command, args, options);\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":"wLAeA,MAAM,EACJ,GAEQ,GAA8C,CACpD,GAAI,CAAC,EAAM,IAAK,MAAO,GAGvB,GAAI,CACF,EAAA,KAAK,EAAM,IAAK,CAAE,KAAM,GAAM,EAAG,EAAmB,IAAoB,CACtE,GAAI,EAAK,CAEP,GAAI,CACF,QAAQ,KAAK,CAAC,EAAM,IAAM,GAAU,UAAU,MACxC,EAGR,OAGF,GAAI,CAAC,EAAM,CAET,GAAI,CACF,QAAQ,KAAK,CAAC,EAAM,IAAM,GAAU,UAAU,MACxC,EAGR,OAGF,IAAK,IAAM,KAAO,EAChB,GAAI,CACF,QAAQ,KAAK,EAAK,GAAU,UAAU,MACzB,IAIjB,MACI,CAEN,GAAI,CACF,QAAQ,KAAK,CAAC,EAAM,IAAK,GAAU,UAAU,MACvC,GAKV,MAAO,IAqBE,GACX,EACA,EACA,IACiB,CACjB,IAAM,GAAA,EAAA,EAAA,OAAkB,EAAS,EAAM,EAAQ,CAG/C,MAFA,GAAM,KAAO,EAAkB,EAAM,CAE9B"}
|
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let node_child_process = require("node:child_process");
|
|
4
|
-
|
|
5
|
-
//#region src/utils/runParallel/spawnWin32.ts
|
|
6
|
-
/**
|
|
7
|
-
* Kills the new process and its sub processes forcibly.
|
|
8
|
-
*/
|
|
9
|
-
const createKillHandler = (child) => {
|
|
10
|
-
return () => {
|
|
11
|
-
if (!child.pid) return false;
|
|
12
|
-
try {
|
|
13
|
-
(0, node_child_process.spawn)("taskkill", [
|
|
14
|
-
"/F",
|
|
15
|
-
"/T",
|
|
16
|
-
"/PID",
|
|
17
|
-
String(child.pid)
|
|
18
|
-
], { stdio: "ignore" });
|
|
19
|
-
} catch {}
|
|
20
|
-
return true;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Launches a new process with the given command.
|
|
25
|
-
* This is almost same as `child_process.spawn`.
|
|
26
|
-
*
|
|
27
|
-
* This returns a `ChildProcess` instance.
|
|
28
|
-
* `kill` method of the instance kills the new process and its sub processes forcibly.
|
|
29
|
-
*
|
|
30
|
-
* @param command - The command to run.
|
|
31
|
-
* @param args - List of string arguments.
|
|
32
|
-
* @param options - Options.
|
|
33
|
-
* @returns A ChildProcess instance of new process.
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
|
-
const spawnWin32 = (command, args, options) => {
|
|
37
|
-
const child = (0, node_child_process.spawn)(command, args, options);
|
|
38
|
-
child.kill = createKillHandler(child);
|
|
39
|
-
return child;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
exports.spawnWin32 = spawnWin32;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`node:child_process`);const t=t=>()=>{if(!t.pid)return!1;try{(0,e.spawn)(`taskkill`,[`/F`,`/T`,`/PID`,String(t.pid)],{stdio:`ignore`})}catch{}return!0},n=(n,r,i)=>{let a=(0,e.spawn)(n,r,i);return a.kill=t(a),a};exports.spawnWin32=n;
|
|
44
2
|
//# sourceMappingURL=spawnWin32.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawnWin32.cjs","names":[],"sources":["../../../../src/utils/runParallel/spawnWin32.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport { type ChildProcess, spawn as nodeSpawn } from 'node:child_process';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes forcibly.\n */\nconst createKillHandler = (child: ChildProcess) => {\n return (): boolean => {\n if (!child.pid) return false;\n\n try {\n nodeSpawn('taskkill', ['/F', '/T', '/PID', String(child.pid)], {\n stdio: 'ignore',\n });\n } catch {\n // ignore\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes forcibly.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnWin32 = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n const child = nodeSpawn(command, args, options);\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"spawnWin32.cjs","names":[],"sources":["../../../../src/utils/runParallel/spawnWin32.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport { type ChildProcess, spawn as nodeSpawn } from 'node:child_process';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes forcibly.\n */\nconst createKillHandler = (child: ChildProcess) => {\n return (): boolean => {\n if (!child.pid) return false;\n\n try {\n nodeSpawn('taskkill', ['/F', '/T', '/PID', String(child.pid)], {\n stdio: 'ignore',\n });\n } catch {\n // ignore\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes forcibly.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnWin32 = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n const child = nodeSpawn(command, args, options);\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":"uJAcA,MAAM,EAAqB,OACH,CACpB,GAAI,CAAC,EAAM,IAAK,MAAO,GAEvB,GAAI,EACF,EAAA,EAAA,OAAU,WAAY,CAAC,KAAM,KAAM,OAAQ,OAAO,EAAM,IAAI,CAAC,CAAE,CAC7D,MAAO,SACR,CAAC,MACI,EAIR,MAAO,IAqBE,GACX,EACA,EACA,IACiB,CACjB,IAAM,GAAA,EAAA,EAAA,OAAkB,EAAS,EAAM,EAAQ,CAG/C,MAFA,GAAM,KAAO,EAAkB,EAAM,CAE9B"}
|
|
@@ -1,53 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_utils_runParallel_bin = require('./bin.cjs');
|
|
4
|
-
let node_os = require("node:os");
|
|
5
|
-
node_os = require_runtime.__toESM(node_os);
|
|
6
|
-
|
|
7
|
-
//#region src/utils/runParallel/wmic.ts
|
|
8
|
-
/**
|
|
9
|
-
* Gets the list of all the pids of the system through the wmic command.
|
|
10
|
-
* @param callback Callback function with error and process list.
|
|
11
|
-
*/
|
|
12
|
-
const wmic = (callback) => {
|
|
13
|
-
require_utils_runParallel_bin.run("wmic", [
|
|
14
|
-
"PROCESS",
|
|
15
|
-
"get",
|
|
16
|
-
"ParentProcessId,ProcessId"
|
|
17
|
-
], {
|
|
18
|
-
windowsHide: true,
|
|
19
|
-
windowsVerbatimArguments: true
|
|
20
|
-
}, (err, stdout, code) => {
|
|
21
|
-
if (err) {
|
|
22
|
-
callback(err);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (code !== 0) {
|
|
26
|
-
callback(/* @__PURE__ */ new Error(`pidtree wmic command exited with code ${code}`));
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (!stdout) {
|
|
30
|
-
callback(/* @__PURE__ */ new Error("No stdout received from wmic command"));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
const lines = stdout.split(node_os.EOL);
|
|
35
|
-
const list = [];
|
|
36
|
-
for (let i = 1; i < lines.length; i++) {
|
|
37
|
-
const trimmed = lines[i].trim();
|
|
38
|
-
if (!trimmed) continue;
|
|
39
|
-
const parts = trimmed.split(/\s+/);
|
|
40
|
-
const ppid = parseInt(parts[0], 10);
|
|
41
|
-
const pid = parseInt(parts[1], 10);
|
|
42
|
-
if (!Number.isNaN(ppid) && !Number.isNaN(pid)) list.push([ppid, pid]);
|
|
43
|
-
}
|
|
44
|
-
callback(null, list);
|
|
45
|
-
} catch (error) {
|
|
46
|
-
callback(error instanceof Error ? error : new Error(String(error)));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
//#endregion
|
|
52
|
-
exports.wmic = wmic;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./bin.cjs`);let n=require(`node:os`);n=e.__toESM(n);const r=e=>{t.run(`wmic`,[`PROCESS`,`get`,`ParentProcessId,ProcessId`],{windowsHide:!0,windowsVerbatimArguments:!0},(t,r,i)=>{if(t){e(t);return}if(i!==0){e(Error(`pidtree wmic command exited with code ${i}`));return}if(!r){e(Error(`No stdout received from wmic command`));return}try{let t=r.split(n.EOL),i=[];for(let e=1;e<t.length;e++){let n=t[e].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])}e(null,i)}catch(t){e(t instanceof Error?t:Error(String(t)))}})};exports.wmic=r;
|
|
53
2
|
//# sourceMappingURL=wmic.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wmic.cjs","names":["os"],"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.cjs","names":["os"],"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":"0LAWA,MAAa,EAAQ,GAAwC,CAM3D,EAAA,IAAI,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,MAAMA,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,8 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/utils/sortAlphabetically.ts
|
|
4
|
-
const sortAlphabetically = (a, b) => a.localeCompare(b);
|
|
5
|
-
|
|
6
|
-
//#endregion
|
|
7
|
-
exports.sortAlphabetically = sortAlphabetically;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=(e,t)=>e.localeCompare(t);exports.sortAlphabetically=e;
|
|
8
2
|
//# sourceMappingURL=sortAlphabetically.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortAlphabetically.cjs","names":[],"sources":["../../../src/utils/sortAlphabetically.ts"],"sourcesContent":["export const sortAlphabetically = (a: string, b: string) => a.localeCompare(b);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sortAlphabetically.cjs","names":[],"sources":["../../../src/utils/sortAlphabetically.ts"],"sourcesContent":["export const sortAlphabetically = (a: string, b: string) => a.localeCompare(b);\n"],"mappings":"mEAAA,MAAa,GAAsB,EAAW,IAAc,EAAE,cAAc,EAAE"}
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/utils/splitTextByLine.ts
|
|
4
|
-
const splitTextByLines = (text) => {
|
|
5
|
-
const splittedText = text.match(/[^\n]*\n|[^\n]*$/g) ?? [];
|
|
6
|
-
if (splittedText.length > 0 && splittedText.at(-1) === "") splittedText.pop();
|
|
7
|
-
return splittedText;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
exports.splitTextByLines = splitTextByLines;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>{let t=e.match(/[^\n]*\n|[^\n]*$/g)??[];return t.length>0&&t.at(-1)===``&&t.pop(),t};exports.splitTextByLines=e;
|
|
12
2
|
//# sourceMappingURL=splitTextByLine.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"splitTextByLine.cjs","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.cjs","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":"mEAAA,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,61 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
|
|
3
|
-
//#region src/utils/verifyIdenticObjectFormat.ts
|
|
4
|
-
/**
|
|
5
|
-
* Verifies that two objects have identical structure (same keys, array lengths, and types)
|
|
6
|
-
* but not necessarily the same values.
|
|
7
|
-
* Useful for validating translations maintain the same format as the original.
|
|
8
|
-
*
|
|
9
|
-
* @param object - The object to verify
|
|
10
|
-
* @param expectedFormat - The expected format to compare against
|
|
11
|
-
* @param path - Current path in the object tree (for error messages)
|
|
12
|
-
* @returns true if structures match, throws error with details if they don't
|
|
13
|
-
*/
|
|
14
|
-
const verifyIdenticObjectFormat = (object, expectedFormat, path = "root") => {
|
|
15
|
-
if (expectedFormat === null || expectedFormat === void 0) {
|
|
16
|
-
if (expectedFormat !== object) return {
|
|
17
|
-
isIdentic: false,
|
|
18
|
-
error: `Type mismatch at ${path}: expected ${expectedFormat === null ? "null" : "undefined"}, got ${object === null ? "null" : typeof object}`
|
|
19
|
-
};
|
|
20
|
-
return { isIdentic: true };
|
|
21
|
-
}
|
|
22
|
-
const expectedType = Array.isArray(expectedFormat) ? "array" : typeof expectedFormat;
|
|
23
|
-
const objectType = Array.isArray(object) ? "array" : typeof object;
|
|
24
|
-
if (expectedType !== objectType) return {
|
|
25
|
-
isIdentic: false,
|
|
26
|
-
error: `Type mismatch at ${path}: expected ${expectedType}, got ${objectType}`
|
|
27
|
-
};
|
|
28
|
-
if (Array.isArray(expectedFormat) && Array.isArray(object)) {
|
|
29
|
-
if (expectedFormat.length !== object.length) return {
|
|
30
|
-
isIdentic: false,
|
|
31
|
-
error: `Array length mismatch at ${path}: expected ${expectedFormat.length} elements, got ${object.length}`
|
|
32
|
-
};
|
|
33
|
-
for (let i = 0; i < expectedFormat.length; i++) {
|
|
34
|
-
const result = verifyIdenticObjectFormat(object[i], expectedFormat[i], `${path}[${i}]`);
|
|
35
|
-
if (!result.isIdentic) return result;
|
|
36
|
-
}
|
|
37
|
-
return { isIdentic: true };
|
|
38
|
-
}
|
|
39
|
-
if (typeof expectedFormat === "object" && typeof object === "object" && expectedFormat !== null && object !== null) {
|
|
40
|
-
const expectedKeys = Object.keys(expectedFormat);
|
|
41
|
-
const objectKeys = Object.keys(object);
|
|
42
|
-
if (expectedKeys.length !== objectKeys.length) return {
|
|
43
|
-
isIdentic: false,
|
|
44
|
-
error: `Object keys count mismatch at ${path}: expected ${expectedKeys.length} keys, got ${objectKeys.length}`
|
|
45
|
-
};
|
|
46
|
-
for (let i = 0; i < expectedKeys.length; i++) if (expectedKeys[i] !== objectKeys[i]) return {
|
|
47
|
-
isIdentic: false,
|
|
48
|
-
error: `Object keys mismatch at ${path}: expected key "${expectedKeys[i]}" at position ${i}, got "${objectKeys[i]}"`
|
|
49
|
-
};
|
|
50
|
-
for (const key of expectedKeys) {
|
|
51
|
-
const result = verifyIdenticObjectFormat(object[key], expectedFormat[key], `${path}.${key}`);
|
|
52
|
-
if (!result.isIdentic) return result;
|
|
53
|
-
}
|
|
54
|
-
return { isIdentic: true };
|
|
55
|
-
}
|
|
56
|
-
return { isIdentic: true };
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
//#endregion
|
|
60
|
-
exports.verifyIdenticObjectFormat = verifyIdenticObjectFormat;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});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}};exports.verifyIdenticObjectFormat=e;
|
|
61
2
|
//# sourceMappingURL=verifyIdenticObjectFormat.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyIdenticObjectFormat.cjs","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.cjs","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":"mEAsBA,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"}
|