You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/11/03 23:11:12 UTC

[GitHub] [cordova-js] raphinesse opened a new pull request #219: Remove unused exports and modules

raphinesse opened a new pull request #219: Remove unused exports and modules
URL: https://github.com/apache/cordova-js/pull/219
 
 
   ### Platforms affected
   All
   
   
   ### Motivation and Context
   <!-- Why is this change required? What problem does it solve? -->
   <!-- If it fixes an open issue, please link to the issue here. -->
   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
   <!-- Describe your changes in detail -->
   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 into `cordova/modulemapper`.
   - From `cordova/utils`
       - `alert`: roughly `msg => (window.alert || console.log)(msg)`
       - `arrayIndexOf`: legacy substitute for `Array.prototype.indexOf`
       - `arrayRemove`: Find item by identity and remove from Array
       - `close`: legacy substitute for `Function.prototype.bind`
       - `isArray`: legacy substitute for `Array.isArray`
       - `isDate`: `d => d instanceof Date`
   - From `cordova/argscheck`
       - `enableChecks`: module variable to disable all checks. Bad design IMHO
   - From `cordova/modulemapper`
       - `defaults`:  like `clobbers` but does nothing if property already exists
   - `cordova.addConstructor`: basically `fn => channel.onCordovaReady.subscribe(fn)`
   
   ### Testing
   <!-- Please describe in detail how you tested your changes. -->
   `npm t`
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org