cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Grieve (JIRA)" <>
Subject [jira] [Commented] (CB-2227) Move mapping of module->symbol into individual plugins
Date Fri, 18 Jan 2013 20:04:12 GMT


Andrew Grieve commented on CB-2227:

The working branch is here:;a=shortlog;h=refs/heads/symbolmapping

Currently steps 1-3 are done. And the File plugin has been moved over to using it.

Next up is to do likewise for other core plugins.

This changes does not affect existing third-party plugins. It would be nice to fold builder
& modulemapper into the same module when this is over, but we should check that no third-party
plugins currently depend on cordova/builder. I think Ripple currently depends on it.
> Move mapping of module->symbol into individual plugins
> ------------------------------------------------------
>                 Key: CB-2227
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS
>            Reporter: Andrew Grieve
>            Assignee: Andrew Grieve
>            Priority: Minor
>             Fix For: 2.4.0
> Goals:
> - Change from listing module->symbol mapping within common.js & platform.js, to
listing this within the plugins themselves.
> - Support apps that don't want us to clobber global symbols. 
> aka, allow module->symbol mapping to be turned off
> - Allow retrieval of clobbered globals
> - Currently modules save it themselves when they are loaded
> - This won't work (reliably) for saving references to globals overridden by other modules
> - This gets in the way of the idea of lazy-loading modules via getters
> - Support the use of other module loaders 
> - So... don't do crazy things at require() time.
> Requirements:
> Plugins must be able to declare dependencies
> Plugins must be able to delay onDeviceReady()
> Plugins must be able to run code to initialize
> Implementation
> modulemapper.js:
> clobbers(...)
> merges(...)
> defaults(...)
> mapModules(wnd)
> getOriginalSymbol('FileSystem')
> Start-up flow:
> Parse all modules
> common-bootstrap:
> Loads list of modules named "cordova.*/symbols"
> Run modulemapper.mapModules(window);
> Loads list of modules named "cordova.*/main"
> symbols.js files:
> Will make calls to modulemapper instead of exporting {clobbers:}
> This make dependencies work by require()ing dependent symbols
> We want the to be an evaluated .js file instead of something listed in plugin.xml
> So that it can export based on browser version
> Implementation Steps
> 1. - Expose list of registered modules in scripts/require.js so that we can loop over
> 2. - Write modulemapper.js (and have unit tests, of course)
> 3. - Add logic to bootstrap.js that calls into modulemapper
> create $PLUGIN_NAME/symbols.js files for each plugin within cordova.
> 4. - Add logic to bootstrap.js that calls into modulemapper
> 5. - Create main.js files for those that currently have logic in their platform.js files

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message