MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / globStep

Function globStep

src/resolution/workspace-packages.ts:1018–1031  ·  view source on GitHub ↗

The states a folder named `name` leads to from `states`; `walking` skips what pnpm's walk skips.

(glob: GlobSegment[], states: Set<number>, name: string, walking: boolean)

Source from the content-addressed store, hash-verified

1016
1017/** The states a folder named `name` leads to from `states`; `walking` skips what pnpm's walk skips. */
1018function globStep(glob: GlobSegment[], states: Set<number>, name: string, walking: boolean): Set<number> {
1019 const next = new Set<number>();
1020 const hidden = walking && (name.startsWith('.') || GLOB_SKIP_DIRS.has(name));
1021 for (const i of states) {
1022 const seg = glob[i];
1023 if (!seg) continue;
1024 if (seg.globstar) {
1025 if (!hidden && !(walking && GLOBSTAR_SKIP_DIRS.has(name))) next.add(i);
1026 } else if (seg.re ? !hidden && seg.re.test(name) : seg.text === name) {
1027 next.add(i + 1);
1028 }
1029 }
1030 return globClosure(glob, next);
1031}
1032
1033/** `states` with every `**` that can match no folder at all stepped over. */
1034function globClosure(glob: GlobSegment[], states: Set<number>): Set<number> {

Callers 2

expandWorkspaceGlobFunction · 0.85
workspaceGlobMatchesFunction · 0.85

Calls 3

globClosureFunction · 0.85
hasMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected