Managing javascript / css dependancies? I know you can add css / js with the drupal_add_css() or drupal_add_js(). Is there a way to define dependancies ?

Use Case Example:


  I need a custom tabs/carousel jquery plugin working. I need jquery and
  jquery ui to load first. In order to ensure that i'd like it to load
  after jquery and jquery ui.


How would one do that? 

Also, is there a way to declare if a script / library is already loaded? i.e. if i load two jquery (1.4 vs 1.8.1) libraries it'll conflict.

Or would this discussion be better suited for the drupal core issue queue?
This is pretty much what hook_library is for.  You define your library

function mymodule_library ()
{
    $path = drupal_get_path("module", "mymodule");

    $libraries = array();

    $libraries["mymodule_util"] = array(
        "title" =&gt; "MyModule Utilities", 
        "version" =&gt; "0.0",
        "js" =&gt; array(
            $path . '/UTIL.js' =&gt; array(),
        ),

        'weight' =&gt; -10,
    );

    return $libraries;
}


You can add CSS and declare dependencies, if needed.

Then you say you want to use it

drupal_add_library("mymodule", "mymodule_util", TRUE);


This ensures all of the dependencies get loaded exactly once.

Check out drupal_add_library for more details.  The core jQuery UI components are loaded this way, too.  The module is system and the names all begin with ui., eg ui.scroller.

I would also check out jQuery Update to upgrade things so you stay in sync with that other jQuery plugins need.