Skip to content

compileGlobPath

compileGlobPath(patternSegments, dialect?, limits?): GlobPathMatcher

Defined in: packages/format-glob/src/compile-glob-path.ts:69

Compiles a pattern given as path segments.

Segments rather than a joined string, and no separator option: joining is lossy the moment a segment may itself contain the delimiter, and a caller that already holds the segments should never have to pick a character that cannot appear in them. ** spans zero or more segments and * matches exactly one; every other segment is compiled with compileGlob under dialect, so the /-shaped constructs inside one segment simply never come up.

Matching is O(path segments × pattern segments) segment tests, with no backtracking: the matcher carries the set of reachable pattern positions forward one path segment at a time.

dialect and limits are resolved once for the whole pattern rather than once per segment, so a ten-segment pattern costs one resolution and not ten.

readonly string[]

GlobDialect = "posix"

GlobLimits

GlobPathMatcher