Branch started! I've completed steps 1 & 2.
https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;a=shortlog;h=refs/heads/symbolmapping On Wed, Jan 16, 2013 at 1:39 PM, Filip Maj <[email protected]> wrote: > This all seems reasonable. Shall we start a branch? > > On 1/15/13 2:47 PM, "Andrew Grieve" <[email protected]> wrote: > > >Sorry to dump another large email on the list, but I'm hoping this one is > >at least less controversial :). I wrote up a plan for moving > >module->symbol > >mapping out of common.js & platform.js and into individual plugins. > > > >If you have feedback/comments, let me know. > > > >* 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: > > > > 1. Parse all modules > > 2. common-bootstrap: > > 1. Loads list of modules named "cordova.*/symbols" > > 2. Run modulemapper.mapModules(window); > > 3. 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 them > > 2. Write modulemapper.js (and have unit tests, of course) > > 3. Add logic to bootstrap.js that calls into modulemapper > > 4. create $PLUGIN_NAME/symbols.js files for each plugin within cordova. > > 5. Add logic to bootstrap.js that calls into modulemapper > > 6. Create main.js files for those that currently have logic in their > > platform.js files > > > >* > >
