Is there an CDI-like mechanism thinkable for JavaScript

Before diving into JavaScript I was doing a lot of Java and especially liked the concept of context dependency injection. I used Google Guice a lot.

I know that JavaScript is not statically typed. And there are modulization concepts like used by requireJs or Node.js (even did something myself).

But is it thinkable or are there already solutions to inject dependencies based on a loosely defined interface.. (hope that isn't too stupid to ask)

The closest thing I have seen to what you are asking for (I think) is Architect from tim caswell.

It allows you to register modules abilities and requirements, so you can essentially request something that can preform an action, and have Architect check all the available modules to see if any of them support such an action.

You may also want to take a look at Errai (http://www.jboss.org/errai). It brings the client and sever together using the same programming paradigm by using the GWT javascript compiler bringing CDI to the browser (they're also working on JPA in the browser as well).