Index: jquery_ui.module
===================================================================
--- jquery_ui.module  (revision 457)
+++ jquery_ui.module  (working copy)
@@ -36,20 +36,8 @@
     $files = array($files);
   }
 
-  // If core hasn't been added yet, add it.
-  if (!isset($ui_core)) {
-    $ui_core = TRUE;
-    jquery_ui_add(array('ui.core'));
-  }
-
   // Loop through list of files to include and add them to the page.
   foreach ($files as $file) {
-    // Any effects files require the effects core file.
-    if (!isset($effects_core) && strpos($file, 'effects.') === 0) {
-      $effects_core = TRUE;
-      jquery_ui_add(array('effects.core'));
-    }
-
     // Load other files.
     if (!isset($loaded_files[$file])) {
       switch ($compression) {
@@ -67,6 +55,18 @@
           break;
       }
       $js_path = $jquery_ui_path . '/' . $file_path;
+      
+      $file_contents = file_get_contents($js_path);
+      preg_match('/^\/\*.*Depends:(.*)\*\//ismu', $file_contents, $matches);
+      preg_match_all('/\s*\*\s*(.+)\n/miu', $matches[1], $depends);
+      
+      if (!empty($depends[1])) {
+        foreach ($depends[1] as &$depend) {
+          $depend = basename(trim($depend), '.js');
+        }
+        jquery_ui_add($depends[1]);
+      }
+      
       drupal_add_js($js_path);
       $loaded_files[$file] = $js_path;
     }
