func hasSourceMapReference(_ string, ext string, content []byte) bool {
	if !canBeMinified(ext) {
		return false
	}
	for _, line := range getLines(content, -2) {
		if sourceMapRegex.Match(line) {
			return true
		}
	}
	return false
}
hasSourceMapReference returns whether the file contains a reference to a
source-map file.
package data
import (
	"bytes"
	"strings"
	"github.com/go-enry/go-enry/v2/regex"
)
var GeneratedCodeExtensions = map[string]struct{}{
	".nib":             {},
	".xcworkspacedata": {},
	".xcuserstate":     {},
}
type GeneratedCodeNameMatcher func(string) bool
func nameMatches(pattern string) GeneratedCodeNameMatcher {
	r := regex.MustCompile(pattern)
	return func(name string) bool {
		return r.MatchString(name)
	}
}
func nameContains(pattern string) GeneratedCodeNameMatcher {
	return func(name string) bool {
		return strings.Contains(name, pattern)
	}
}
func nameEndsWith(pattern string) GeneratedCodeNameMatcher {
	return func(name string) bool {
		return strings.HasSuffix(name, pattern)
	}
}
var GeneratedCodeNameMatchers = []GeneratedCodeNameMatcher{
	nameMatches(`(^Pods|\/Pods)\/`),
	nameMatches(`(^|\/)Carthage\/Build\/`),
	nameMatches(`(?i)\.designer\.(cs|vb)$`),
	nameEndsWith(".feature.cs"),
	nameContains("node_modules/"),
	nameMatches(`vendor\/([-0-9A-Za-z]+\.)+(com|edu|gov|in|me|net|org|fm|io)`),
	nameEndsWith("Gopkg.lock"),
	nameEndsWith("glide.lock"),
	nameMatches(`(^|\/)(\w+\.)?esy.lock$`),
	nameEndsWith("npm-shrinkwrap.json"),
	nameEndsWith("package-lock.json"),
	nameMatches(`(^|\/)\.pnp\.(c|m)?js$`),
	nameContains("Godeps/"),
	nameEndsWith("composer.lock"),
	nameMatches(`.\.zep\.(?:c|h|php)$`),
	nameEndsWith("Cargo.lock"),
	nameEndsWith("Pipfile.lock"),
	nameContains("__generated__/"),
}
type GeneratedCodeMatcher func(path, ext string, content []byte) bool
var GeneratedCodeMatchers = []GeneratedCodeMatcher{
	isMinifiedFile,
	hasSourceMapReference,
	isSourceMap,
	isCompiledCoffeeScript,
	isGeneratedNetDocfile,
	isGeneratedJavaScriptPEGParser,
	isGeneratedPostScript,
	isGeneratedGo,
	isGeneratedProtobuf,
	isGeneratedJavaScriptProtocolBuffer,
	isGeneratedApacheThrift,
	isGeneratedJNIHeader,
	isVCRCassette,
	isCompiledCythonFile,
	isGeneratedModule,
	isGeneratedUnity3DMeta,
	isGeneratedRacc,
	isGeneratedJFlex,
	isGeneratedGrammarKit,
	isGeneratedRoxygen2,
	isGeneratedJison,
	isGeneratedGRPCCpp,
	isGeneratedDart,
	isGeneratedPerlPPPortHeader,
	isGeneratedGameMakerStudio,
	isGeneratedGimp,
	isGeneratedVisualStudio6,
	isGeneratedHaxe,
	isGeneratedHTML,
	isGeneratedJooq,
}
func canBeMinified(ext string) bool {
	return ext == ".js" || ext == ".css"
}
func isMinifiedFile(path, ext string, content []byte) bool {
	if !canBeMinified(ext) {
		return false
	}
	var chars, lines uint64
	forEachLine(content, func(line []byte) {
		chars += uint64(len(line))
		lines++
	})
	if lines == 0 {
		return false
	}
	return chars/lines > 110
}
var sourceMapRegex = regex.MustCompile(`^\/[*\/][\#@] source(?:Mapping)?URL|sourceURL=`)