(pattern: string, match: (path: string) => boolean)
| 980 | // BuildKit's wildcard-free prefix rule. Docker's `**` crosses `/`, so a |
| 981 | // stripped `/**` also matches everything below the prefix. |
| 982 | const 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 | } |
no test coverage detected