@@ -96,14 +96,20 @@ getModuleGraphWithPackage (ModuleGraph graph) = do
9696 # Map .union (Map .fromFoldable $ map mkPackageEntry selected)
9797 # Map .union testPackages
9898
99+ -- TODO: here we are calculating the globs for each package, potentially multiple times.
100+ -- We should memoise them, so that when we get the graph for a monorepo we don't evaluate the globs again.
101+ -- Each call is a few milliseconds, but there are potentially hundreds of those, and it adds up.
102+ logDebug " Calling pathToPackage..."
99103 pathToPackage :: Map FilePath PackageName <- map (Map .fromFoldable <<< Array .fold)
100104 $ for (Map .toUnfoldable allPackages)
101105 \(Tuple name package) -> do
102106 -- Basically partition the modules of the current package by in src and test packages
103107 let withTestGlobs = if (Set .member name (Map .keys testPackages)) then OnlyTestGlobs else NoTestGlobs
108+ logDebug $ " Getting globs for package " <> PackageName .print name
104109 globMatches :: Array FilePath <- map Array .fold $ traverse compileGlob (Config .sourceGlob withTestGlobs name package)
105110 pure $ map (\p -> Tuple p name) globMatches
106111
112+ logDebug " Got the pathToPackage map, calling packageGraph"
107113 let
108114 -- Using `pathToPackage`, add the PackageName to each module entry in the graph
109115 addPackageInfo :: ModuleGraphWithPackage -> Tuple ModuleName ModuleGraphNode -> ModuleGraphWithPackage
@@ -182,6 +188,7 @@ checkImports :: forall a. ModuleGraph -> Spago (ImportsGraphEnv a) ImportCheckRe
182188checkImports graph = do
183189 env@{ selected, workspacePackages } <- ask
184190 packageGraph <- runSpago (Record .union { selected: workspacePackages } env) $ getModuleGraphWithPackage graph
191+ logDebug $ " Got the package graph for package " <> PackageName .print selected.package.name
185192
186193 let
187194 dropValues = Map .mapMaybe (const (Just Map .empty))
0 commit comments