MCPcopy Create free account
hub / github.com/Effect-TS/effect / dockerMatcher

Function dockerMatcher

packages/effect/src/IgnoreFile.ts:982–995  ·  view source on GitHub ↗
(pattern: string, match: (path: string) => boolean)

Source from the content-addressed store, hash-verified

980// BuildKit's wildcard-free prefix rule. Docker's `**` crosses `/`, so a
981// stripped `/**` also matches everything below the prefix.
982const dockerMatcher = (pattern: string, match: (path: string) => boolean): PathFilter.PathMatcher => {
983 const prefix = withoutTrailingGlob(pattern)
984 const everything = pattern.endsWith("/**")
985 const matcher: PathFilter.PathMatcher = {
986 match,
987 matchesBelow: wildcardChars.test(prefix) ?
988 undefined :
989 (directory) =>
990 directory === "" || `${prefix}/`.startsWith(`${directory}/`) ||
991 (everything && directory.startsWith(`${prefix}/`))
992 }
993 // Docker ignores whether a path is a directory
994 return Engine.register(matcher, Engine.fromMatcher(matcher, false))
995}

Callers 1

parseDockerignoreFunction · 0.85

Calls 2

withoutTrailingGlobFunction · 0.85
registerMethod · 0.45

Tested by

no test coverage detected