You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Patrick Mueller (Created) (JIRA)" <ji...@apache.org> on 2012/03/15 16:45:39 UTC

[jira] [Created] (CB-341) allow Cordova's module runtime to be replaced with a different runtime

allow Cordova's module runtime to be replaced with a different runtime
----------------------------------------------------------------------

                 Key: CB-341
                 URL: https://issues.apache.org/jira/browse/CB-341
             Project: Apache Callback
          Issue Type: Wish
          Components: CordovaJS
            Reporter: Patrick Mueller
            Assignee: Filip Maj
            Priority: Minor


I don't think there's a given use case for this right now, but we might see one in a future Cordova that ships it's plugins as CJS modules, externally.  Today the "batteries provided" plugins use the module runtime in a protected way, which is fine as we ship a single "cordova-x.y.z.js" as our release (we do not ship CJS modules externally).

Once we do ship CJS modules externally, folks might want to do a "build" which uses some other "compliant" runtime.  Eg, almond, requirejs, or Dojo.  See some discussion here: 

    http://callback.markmail.org/thread/wjcop7sg67hmqdcq

Some folks working on Dojo have expressed some interest in seeing something like this work, so I figured I'd go ahead and plant a stake in the ground, for the work that will need to happen at Cordova, and for other module runtime devs to follow along with.

At this point, the only work I see us doing is nailing down what are runtime requirements for our module system are.  They are basically CJS modules, with the simple AMD define(moduleId, factoryFunction) API added - no plugins or any of that jazz from "the AMD spec".  But we should be more specific.  By having some kind of test harness that would easily allow someone to test their AMD runtime being used by Cordova's modules.  

Seems like most AMD impls should work out of the box with this, but it turns out they don't; see the above email thread for more info.  

We could actually build a test harness for this today, as a new task in the Jakefile.  I'd be happy to do this if someone is willing to fix their module impl enough to try.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CB-341) allow Cordova's module runtime to be replaced with a different runtime

Posted by "Patrick Mueller (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13255994#comment-13255994 ] 

Patrick Mueller commented on CB-341:
------------------------------------

Folks interested in this issue may want to read the thread "Using Dojo to load PhoneGap" [1] in the dojo-contributors mailing list which discusses using Dojo's module loader in Cordova.  I'm thinking that most of the thoughts here apply to any/most/some AMD impls.

[1] http://thread.gmane.org/gmane.comp.web.dojo.devel/17395
                
> allow Cordova's module runtime to be replaced with a different runtime
> ----------------------------------------------------------------------
>
>                 Key: CB-341
>                 URL: https://issues.apache.org/jira/browse/CB-341
>             Project: Apache Callback
>          Issue Type: Wish
>          Components: CordovaJS
>            Reporter: Patrick Mueller
>            Assignee: Filip Maj
>            Priority: Minor
>
> I don't think there's a given use case for this right now, but we might see one in a future Cordova that ships it's plugins as CJS modules, externally.  Today the "batteries provided" plugins use the module runtime in a protected way, which is fine as we ship a single "cordova-x.y.z.js" as our release (we do not ship CJS modules externally).
> Once we do ship CJS modules externally, folks might want to do a "build" which uses some other "compliant" runtime.  Eg, almond, requirejs, or Dojo.  See some discussion here: 
>     http://callback.markmail.org/thread/wjcop7sg67hmqdcq
> Some folks working on Dojo have expressed some interest in seeing something like this work, so I figured I'd go ahead and plant a stake in the ground, for the work that will need to happen at Cordova, and for other module runtime devs to follow along with.
> At this point, the only work I see us doing is nailing down what are runtime requirements for our module system are.  They are basically CJS modules, with the simple AMD define(moduleId, factoryFunction) API added - no plugins or any of that jazz from "the AMD spec".  But we should be more specific.  By having some kind of test harness that would easily allow someone to test their AMD runtime being used by Cordova's modules.  
> Seems like most AMD impls should work out of the box with this, but it turns out they don't; see the above email thread for more info.  
> We could actually build a test harness for this today, as a new task in the Jakefile.  I'd be happy to do this if someone is willing to fix their module impl enough to try.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira