build(deps): bump github.com/open-policy-agent/opa from 1.6.0 to 1.8.0

Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 1.6.0 to 1.8.0.
- [Release notes](https://github.com/open-policy-agent/opa/releases)
- [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-policy-agent/opa/compare/v1.6.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/open-policy-agent/opa
  dependency-version: 1.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2025-09-17 11:57:20 +00:00
committed by Ralf Haferkamp
parent 98d773bb9b
commit 76ac20e9e8
419 changed files with 57008 additions and 13314 deletions

View File

@@ -1146,13 +1146,28 @@ func (dmp *DiffMatchPatch) DiffPrettyText(diffs []Diff) string {
switch diff.Type {
case DiffInsert:
_, _ = buff.WriteString("\x1b[32m")
_, _ = buff.WriteString(text)
_, _ = buff.WriteString("\x1b[0m")
lines := strings.Split(text, "\n")
for i, line := range lines {
_, _ = buff.WriteString("\x1b[32m")
_, _ = buff.WriteString(line)
if i < len(lines)-1 {
_, _ = buff.WriteString("\x1b[0m\n")
} else {
_, _ = buff.WriteString("\x1b[0m")
}
}
case DiffDelete:
_, _ = buff.WriteString("\x1b[31m")
_, _ = buff.WriteString(text)
_, _ = buff.WriteString("\x1b[0m")
lines := strings.Split(text, "\n")
for i, line := range lines {
_, _ = buff.WriteString("\x1b[31m")
_, _ = buff.WriteString(line)
if i < len(lines)-1 {
_, _ = buff.WriteString("\x1b[0m\n")
} else {
_, _ = buff.WriteString("\x1b[0m")
}
}
case DiffEqual:
_, _ = buff.WriteString(text)
}
@@ -1305,7 +1320,6 @@ func (dmp *DiffMatchPatch) DiffFromDelta(text1 string, delta string) (diffs []Di
// diffLinesToStrings splits two texts into a list of strings. Each string represents one line.
func (dmp *DiffMatchPatch) diffLinesToStrings(text1, text2 string) (string, string, []string) {
// '\x00' is a valid character, but various debuggers don't like it. So we'll insert a junk entry to avoid generating a null character.
lineArray := []string{""} // e.g. lineArray[4] == 'Hello\n'
lineHash := make(map[string]int)
@@ -1316,12 +1330,11 @@ func (dmp *DiffMatchPatch) diffLinesToStrings(text1, text2 string) (string, stri
return intArrayToString(strIndexArray1), intArrayToString(strIndexArray2), lineArray
}
// diffLinesToStringsMunge splits a text into an array of strings, and reduces the texts to a []string.
func (dmp *DiffMatchPatch) diffLinesToStringsMunge(text string, lineArray *[]string, lineHash map[string]int) []uint32 {
// Walk the text, pulling out a substring for each line. text.split('\n') would would temporarily double our memory footprint. Modifying text would create many large strings to garbage collect.
// diffLinesToStringsMunge splits a text into an array of strings, and reduces the texts to a []index.
func (dmp *DiffMatchPatch) diffLinesToStringsMunge(text string, lineArray *[]string, lineHash map[string]int) []index {
lineStart := 0
lineEnd := -1
strs := []uint32{}
strs := []index{}
for lineEnd < len(text)-1 {
lineEnd = indexOf(text, "\n", lineStart)
@@ -1335,11 +1348,11 @@ func (dmp *DiffMatchPatch) diffLinesToStringsMunge(text string, lineArray *[]str
lineValue, ok := lineHash[line]
if ok {
strs = append(strs, uint32(lineValue))
strs = append(strs, index(lineValue))
} else {
*lineArray = append(*lineArray, line)
lineHash[line] = len(*lineArray) - 1
strs = append(strs, uint32(len(*lineArray)-1))
strs = append(strs, index(len(*lineArray)-1))
}
}

View File

@@ -0,0 +1,32 @@
package diffmatchpatch
type index uint32
const runeSkipStart = 0xd800
const runeSkipEnd = 0xdfff + 1
const runeMax = 0x110000 // next invalid code point
func stringToIndex(text string) []index {
runes := []rune(text)
indexes := make([]index, len(runes))
for i, r := range runes {
if r < runeSkipEnd {
indexes[i] = index(r)
} else {
indexes[i] = index(r) - (runeSkipEnd - runeSkipStart)
}
}
return indexes
}
func indexesToString(indexes []index) string {
runes := make([]rune, len(indexes))
for i, index := range indexes {
if index < runeSkipStart {
runes[i] = rune(index)
} else {
runes[i] = rune(index + (runeSkipEnd - runeSkipStart))
}
}
return string(runes)
}

View File

@@ -93,14 +93,14 @@ func runesIndex(r1, r2 []rune) int {
return -1
}
func intArrayToString(ns []uint32) string {
func intArrayToString(ns []index) string {
if len(ns) == 0 {
return ""
}
b := []rune{}
for _, n := range ns {
b = append(b, intToRune(n))
b = append(b, intToRune(uint32(n)))
}
return string(b)
}