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

Function globStep

src/resolution/workspace-packages.ts:1026–1039  ·  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

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