code: protected function loadDependency($bundle, &$result)
      {
          $am = $this->getAssetManager();
          foreach ($bundle->depends as $name) {
              if (!isset($result[$name])) {
                  $dependencyBundle = $am->getBundle($name);
                  $result[$name] = false;
                  $this->loadDependency($dependencyBundle, $result);
                  $result[$name] = $dependencyBundle;
              } elseif ($result[$name] === false) {
                  throw new Exception("A circular dependency is detected for bundle '{$name}': " . $this->composeCircularDependencyTrace($name, $result) . '.');
              }
          }
      }
docs: Loads asset bundle dependencies recursively.
  @param \yii\web\AssetBundle $bundle bundle instance
  @param array $result already loaded bundles list.
  @throws Exception on failure.