Remove unused exports and modules
Platforms affected
All
Motivation and Context
I'm always trying to reduce the footprint of our code base by removing unused code. Thus this PR removes a bunch of exports that are not being used by any official apache/cordova-* repository.
Unfortunately, while many of our modules that are available through cordova.require seem like they are intended for internal use only and there is no public documentation of them either (at least not to my knowledge), they are still being used in the wild by third party plugins (I checked it for one or two more unique names via GH search). Thus we will have to tread lightly here.
I'm putting this PR up for awareness and discussion. It would be great if we could somehow get an idea of the impact of these changes. That would allow us to make an informed decision on whether we should deprecate all or some of the exports first. But unfortunately GH search seems to be too fuzzy to efficiently search for usages of these exports. I'm open for ideas.
Description
This change removes the following exports and modules that are available via cordova.require
- The whole module
cordova/builder- had only been used partly and only by
cordova/modulemapper. Had no tests of its own either. Thus I integrated the used functions intocordova/modulemapper.
- had only been used partly and only by
- From
cordova/utilsalert: roughlymsg => (window.alert || console.log)(msg)arrayIndexOf: legacy substitute forArray.prototype.indexOfarrayRemove: Find item by identity and remove from Arrayclose: legacy substitute forFunction.prototype.bindisArray: legacy substitute forArray.isArrayisDate:d => d instanceof Date
- From
cordova/argscheckenableChecks: module variable to disable all checks. Bad design IMHO
- From
cordova/modulemapperdefaults: likeclobbersbut does nothing if property already exists
cordova.addConstructor: basicallyfn => channel.onCordovaReady.subscribe(fn)
Testing
npm t
can this be closed? is it still valid?
I won't be able to see this through any time soon. If there is no value in leaving this PR open as a reminder to others, please feel free to close it.