20 lines
969 B
PowerShell
20 lines
969 B
PowerShell
$filePath = "d:\Development\SingBox-Gopanel\frontend\admin\reverse\output\index-CO3BwsT2.pretty.js"
|
|
|
|
# Read file
|
|
$content = [System.IO.File]::ReadAllText($filePath)
|
|
|
|
# Regex patterns (escaping literals to handle parens and braces correctly)
|
|
$t1 = [regex]::Escape("Q.jsx(Lot, {") + "\s+" + [regex]::Escape("asChild: !0,") + "\s+" + [regex]::Escape("children: Q.jsx(Nm, {")
|
|
$r1 = "Q.jsx(Lot, { asChild: !0, onClick: (e) => (e.stopPropagation(), e.preventDefault()), children: Q.jsx(Nm, {"
|
|
|
|
$t2 = [regex]::Escape("onSelect: (e) => {") + "\s+" + [regex]::Escape("(e.preventDefault(), l());")
|
|
$r2 = "onSelect: (e) => { (e.preventDefault(), e.stopPropagation(), l());"
|
|
|
|
# Perform replacements
|
|
$content = [System.Text.RegularExpressions.Regex]::Replace($content, $t1, $r1)
|
|
$content = [System.Text.RegularExpressions.Regex]::Replace($content, $t2, $r2)
|
|
|
|
# Write back
|
|
[System.IO.File]::WriteAllText($filePath, $content)
|
|
Write-Output "Patch applied successfully (Regex Escaped)"
|