code: public static Set<ModuleId> getDependencyScriptModuleIds(ModuleSpec moduleSpec) {
          Objects.requireNonNull(moduleSpec, "moduleSpec");
          if (!(moduleSpec instanceof ConcreteModuleSpec)) {
              throw new IllegalArgumentException("Unsupported ModuleSpec implementation: " + moduleSpec.getClass().getName());
          }
          Set<ModuleId> dependencyNames = new LinkedHashSet<ModuleId>();
          ConcreteModuleSpec concreteSpec = (ConcreteModuleSpec)moduleSpec;
          for (DependencySpec dependencSpec : concreteSpec.getDependencies()) {
              if (dependencSpec instanceof ModuleDependencySpec) {
                  ModuleIdentifier revisionId = ((ModuleDependencySpec)dependencSpec).getIdentifier();
                  dependencyNames.add(ModuleId.fromString(revisionId.getName()));
              }
          }
          return dependencyNames;
      }
docs: Extract the Module dependencies for the given module in the form
  of ScriptModule ids.