I sent around a document[1] outlining my plan for automatically installing
plugin Javascript files last week. The prototype is complete and in a pull
request[2] now.

tl;dr for how this works is: <js-module> tags in the plugin.xml specify
<clobbers>, <merges> and <runs> for each JS file; cordova prepare copies
the JS files into the platforms and injects code at the end of cordova.js
to cordova.require the modules and do the clobbering and merging.

Please take a look and see what you think. If you want to try it, check out
my fork's auto_js branch and install it. You'll need some ported plugins to
install, for which see:
https://github.com/MobileChromeApps/refresh
https://github.com/MobileChromeApps/chrome-cordova/tree/plugins/plugins/socket
https://github.com/MobileChromeApps/chrome-cordova/tree/plugins/plugins/storage

I'm pleased with how things turned out, in the code and in the interface. I
think this is the right approach for automatic installation. It doesn't
pollute top-level www, has no risk of collision between plugins or between
plugins and user code, and uses existing tools like the module mapper.

Comments welcome.

Braden

[1]
https://docs.google.com/document/d/1fhwnIZ5TqwklGx71pLmfSghysls1S4_5ktEsjA9ac5Y/edit
[2] https://github.com/apache/cordova-cli/pull/4

Reply via email to