You specify what JS path you want to merge into. I think this is wrong.

E.g.:
<js-module src="..." name="A" >
  <clobbers target="window.plugins.A" />
  <clobbers target="window.oldPath.A" />
</js-module>

<platform name="ios">
<js-module ...>
  <merges target="window.plugins.A" />
  <merges target="window.oldPath.A" />
</js-module>
</platform>

With this example, you'd actually only need to have a single merge line,
since window.plugins.A and window.oldPath.A actually refer to the same
object. It's also less apparent when specifying the symbol path, that
you're modifying the actual module that maps to it.

Instead - I think what better captures the merges use-case would be to
specify the name of the *module* to merge into. E.g.:

<js-module src="..." name="A">
  <clobbers target="window.plugins.A" />
  <clobbers target="window.oldPath.A" />
</js-module>

<platform name="ios">
<js-module ...>
  <merges target="A" />
</js-module>
</platform>


We could then also have a plugman-time check that the "A" module exists to
be merged into.

Existing uses of <merges> are minimal, so I think we can change this now
without harm:

$ grep merges cordova*plugin*/plugin.xml
cordova-plugin-contacts/plugin.xml:            <merges
target="navigator.contacts" />
cordova-plugin-contacts/plugin.xml:            <merges target="Contact" />
cordova-plugin-dialogs/plugin.xml:        <merges
target="navigator.notification" />
cordova-plugin-dialogs/plugin.xml:            <merges
target="navigator.notification" />
cordova-plugin-file/plugin.xml:            <merges target="window.Entry" />
cordova-plugin-file/plugin.xml:            <merges
target="window.FileUploadOptions" />
cordova-plugin-file/plugin.xml:            <merges
target="window.FileUploadOptions" />

Reply via email to