Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused exports and modules #219

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

raphinesse
Copy link
Contributor

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 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

npm t

@purplecabbage
Copy link
Contributor

can this be closed? is it still valid?

@raphinesse
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants