const fs = require('fs'); let code = fs.readFileSync('src/components/TerminalPanel.vue', 'utf8'); // Remove variables code = code.replace(/let touchScrollVelocity = 0;\n?/g, ''); code = code.replace(/let touchScrollRaf:\s*number\s*\|\s*null = null;\n?/g, ''); // Remove clearTouchScrollMomentum definition code = code.replace(/function clearTouchScrollMomentum\(\): void \{[\s\S]*?\}\n/g, ''); // Remove runTouchScrollMomentum definition code = code.replace(/function runTouchScrollMomentum\(\): void \{[\s\S]*?\}\n/g, ''); // Remove velocity tracking in pointermove code = code.replace(/\s*const v = \(\-deltaY \/ dt\) \* 16;[\s\S]*?if \(touchScrollVelocity > touchMaxSpeed\) touchScrollVelocity = touchMaxSpeed;/g, ''); // Remove velocity tracking in touchmove code = code.replace(/\s*\/\/ 计算物理滑动速度,用于释放后的动量[\s\S]*?\n\s*if \(Math\.abs\(dy\) > 2\) \{/g, '\n if (Math.abs(dy) > 2) {'); // Remove velocity call in touchend code = code.replace(/\s*if \(Math\.abs\(touchScrollVelocity\) > 0\.2\) \{[\s\S]*?\n\s*\}/g, ''); // Remove velocity call in pointerup code = code.replace(/\s*\/\/ 释放时触发滚行动量\s*if \(Math\.abs\(touchScrollVelocity\) > 0\.2 && touchGateScrollLike && !hasActiveNativeSelectionInTerminal\(\)\) \{[\s\S]*?\n\s*\}/g, ''); // Clean calls to clearTouchScrollMomentum code = code.replace(/\s*clearTouchScrollMomentum\(\);/g, ''); fs.writeFileSync('src/components/TerminalPanel.vue', code);