workspaceGlobMembers function

List<String> workspaceGlobMembers(
  1. String root,
  2. List<String> globs
)

The member paths, relative to root with / separators, that globs match: directories with a pubspec that has resolution: workspace.

Implementation

List<String> workspaceGlobMembers(String root, List<String> globs) {
  final canonicalRoot = canonicalPath(root);
  final members = <String>{
    for (final pattern in globs)
      for (final path in Workspace.expandPattern(pattern, canonicalRoot))
        if (WorkspacePackage.read(
              path,
              root: canonicalRoot,
            )?.isWorkspaceMember ??
            false)
          toPosixPath(p.relative(path, from: canonicalRoot)),
  };
  return members.toList()..sort();
}