updated bundled node_modules

This commit is contained in:
Steve Gill
2017-09-05 11:04:12 -07:00
parent 2377aa7ac2
commit e7a972df77
73 changed files with 3553 additions and 915 deletions
+40 -43
View File
@@ -36,7 +36,7 @@ var PluginInfoProvider = require('./PluginInfo/PluginInfoProvider');
* @param {Object} locations - Platform files and directories
* @param {IDEProject} ideProject The IDE project to add/remove plugin changes to/from
*/
function PluginManager(platform, locations, ideProject) {
function PluginManager (platform, locations, ideProject) {
this.platform = platform;
this.locations = locations;
this.project = ideProject;
@@ -45,7 +45,6 @@ function PluginManager(platform, locations, ideProject) {
this.munger = new PlatformMunger(platform, locations.root, platformJson, new PluginInfoProvider());
}
/**
* @constructs PluginManager
* A convenience shortcut to new PluginManager(...)
@@ -55,7 +54,7 @@ function PluginManager(platform, locations, ideProject) {
* @param {IDEProject} ideProject The IDE project to add/remove plugin changes to/from
* @returns new PluginManager instance
*/
PluginManager.get = function(platform, locations, ideProject) {
PluginManager.get = function (platform, locations, ideProject) {
return new PluginManager(platform, locations, ideProject);
};
@@ -82,11 +81,9 @@ module.exports = PluginManager;
* @returns {Promise} Returns a Q promise, either resolved in case of success, rejected otherwise.
*/
PluginManager.prototype.doOperation = function (operation, plugin, options) {
if (operation !== PluginManager.INSTALL && operation !== PluginManager.UNINSTALL)
return Q.reject(new CordovaError('The parameter is incorrect. The opeation must be either "add" or "remove"'));
if (operation !== PluginManager.INSTALL && operation !== PluginManager.UNINSTALL) { return Q.reject(new CordovaError('The parameter is incorrect. The opeation must be either "add" or "remove"')); }
if (!plugin || plugin.constructor.name !== 'PluginInfo')
return Q.reject(new CordovaError('The parameter is incorrect. The first parameter should be a PluginInfo instance'));
if (!plugin || plugin.constructor.name !== 'PluginInfo') { return Q.reject(new CordovaError('The parameter is incorrect. The first parameter should be a PluginInfo instance')); }
// Set default to empty object to play safe when accesing properties
options = options || {};
@@ -95,52 +92,52 @@ PluginManager.prototype.doOperation = function (operation, plugin, options) {
var actions = new ActionStack();
// gather all files need to be handled during operation ...
plugin.getFilesAndFrameworks(this.platform)
plugin.getFilesAndFrameworks(this.platform, options)
.concat(plugin.getAssets(this.platform))
.concat(plugin.getJsModules(this.platform))
// ... put them into stack ...
.forEach(function(item) {
var installer = self.project.getInstaller(item.itemType);
var uninstaller = self.project.getUninstaller(item.itemType);
var actionArgs = [item, plugin, self.project, options];
// ... put them into stack ...
.forEach(function (item) {
var installer = self.project.getInstaller(item.itemType);
var uninstaller = self.project.getUninstaller(item.itemType);
var actionArgs = [item, plugin, self.project, options];
var action;
if (operation === PluginManager.INSTALL) {
action = actions.createAction.apply(actions, [installer, actionArgs, uninstaller, actionArgs]);
} else /* op === PluginManager.UNINSTALL */{
action = actions.createAction.apply(actions, [uninstaller, actionArgs, installer, actionArgs]);
}
actions.push(action);
});
var action;
if (operation === PluginManager.INSTALL) {
action = actions.createAction.apply(actions, [installer, actionArgs, uninstaller, actionArgs]); /* eslint no-useless-call: 0 */
} else /* op === PluginManager.UNINSTALL */{
action = actions.createAction.apply(actions, [uninstaller, actionArgs, installer, actionArgs]); /* eslint no-useless-call: 0 */
}
actions.push(action);
});
// ... and run through the action stack
return actions.process(this.platform)
.then(function () {
if (self.project.write) {
self.project.write();
}
.then(function () {
if (self.project.write) {
self.project.write();
}
if (operation === PluginManager.INSTALL) {
// Ignore passed `is_top_level` option since platform itself doesn't know
// anything about managing dependencies - it's responsibility of caller.
self.munger.add_plugin_changes(plugin, options.variables, /*is_top_level=*/true, /*should_increment=*/true, options.force);
self.munger.platformJson.addPluginMetadata(plugin);
} else {
self.munger.remove_plugin_changes(plugin, /*is_top_level=*/true);
self.munger.platformJson.removePluginMetadata(plugin);
}
if (operation === PluginManager.INSTALL) {
// Ignore passed `is_top_level` option since platform itself doesn't know
// anything about managing dependencies - it's responsibility of caller.
self.munger.add_plugin_changes(plugin, options.variables, /* is_top_level= */true, /* should_increment= */true, options.force);
self.munger.platformJson.addPluginMetadata(plugin);
} else {
self.munger.remove_plugin_changes(plugin, /* is_top_level= */true);
self.munger.platformJson.removePluginMetadata(plugin);
}
// Save everything (munge and plugin/modules metadata)
self.munger.save_all();
// Save everything (munge and plugin/modules metadata)
self.munger.save_all();
var metadata = self.munger.platformJson.generateMetadata();
fs.writeFileSync(path.join(self.locations.www, 'cordova_plugins.js'), metadata, 'utf-8');
var metadata = self.munger.platformJson.generateMetadata();
fs.writeFileSync(path.join(self.locations.www, 'cordova_plugins.js'), metadata, 'utf-8');
// CB-11022 save plugin metadata to both www and platform_www if options.usePlatformWww is specified
if (options.usePlatformWww) {
fs.writeFileSync(path.join(self.locations.platformWww, 'cordova_plugins.js'), metadata, 'utf-8');
}
});
// CB-11022 save plugin metadata to both www and platform_www if options.usePlatformWww is specified
if (options.usePlatformWww) {
fs.writeFileSync(path.join(self.locations.platformWww, 'cordova_plugins.js'), metadata, 'utf-8');
}
});
};
PluginManager.prototype.addPlugin = function (plugin, installOptions) {