Documentation
¶
Index ¶
- func BytesToLines(data []byte) []string
- func ExtractDelimitedRegexpPositionInBlock(block []string, str string, blockStartLine int, prefix string, suffix string) *models.FilePosition
- func ExtractDelimitedStringPositionInBlock(block []string, str string, blockStartLine int, prefix string, suffix string) *models.FilePosition
- func ExtractStringPositionInBlock(block []string, str string, blockStartLine int) *models.FilePosition
- func GetFirstNonEmptyCharacterIndexInLine(line string) int
- func GetLastNonEmptyCharacterIndexInLine(line string) int
- func InBunLockPackages(sanitized []byte) map[string]models.FilePosition
- func InJSON[P models.IFilePosition](groupKey string, dependencies map[string]P, lines []string, offset int)
- func InTOML[P models.IFilePosition](groupKey string, otherKey string, dependencies []P, lines []string)
- func IsFilePositionExtractedSuccessfully(filePosition models.FilePosition) bool
- func ShouldExcludePath(dir, path string, excludePaths []string) (bool, string, error)
- func ToRelativePath(scanPath string, packagePath string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToLines ¶
func ExtractStringPositionInBlock ¶
func ExtractStringPositionInBlock(block []string, str string, blockStartLine int) *models.FilePosition
func InBunLockPackages ¶ added in v1.18.1
func InBunLockPackages(sanitized []byte) map[string]models.FilePosition
InBunLockPackages scans a JSONC-sanitized bun.lock buffer and returns a map keyed by the exact package key found inside the top-level "packages" object, mapping each key to the source FilePosition of its tuple entry.
The input is expected to be CRLF-normalized and JSONC-sanitized so that positions map 1:1 to the raw file. All positions are 1-indexed:
- Line.Start / Line.End span the entry's opening line (the key) through the line containing the tuple's closing "]".
- Column.Start is the column of the key's opening quote.
- Column.End is the column immediately after the tuple's closing "]".
The returned FilePosition leaves Filename empty; the caller sets it.
The scan is a single pass over the bytes. Brackets and braces only affect the combined nesting depth when they occur outside a quoted string; a string is closed by a double quote preceded by an even number of consecutive backslashes. The "packages" object is matched by its exact quoted token at root-object depth, so decoy keys such as "packages/a" (a workspace key) are never mistaken for it.
func InTOML ¶
func InTOML[P models.IFilePosition](groupKey string, otherKey string, dependencies []P, lines []string)
func IsFilePositionExtractedSuccessfully ¶
func IsFilePositionExtractedSuccessfully(filePosition models.FilePosition) bool
func ShouldExcludePath ¶ added in v0.0.3
ShouldExcludePath checks if a given path should be excluded based on a list of exclusion patterns.
func ToRelativePath ¶
Types ¶
This section is empty.