updated bundled cordova-common to 1.4.1

This commit is contained in:
Steve Gill 2016-08-16 13:23:10 -07:00
parent 6c80f58e2a
commit 2664180b32
10 changed files with 189 additions and 94 deletions

View File

@ -20,8 +20,12 @@
-->
# Cordova-common Release Notes
### 1.4.0 (Jul 12, 2016)
* [CB-11023](https://issues.apache.org/jira/browse/CB-11023) Add edit-config functionality
### 1.4.1 (Aug 09, 2016)
* Add general purpose `ConfigParser.getAttribute` API
* [CB-11653](https://issues.apache.org/jira/browse/CB-11653) moved `findProjectRoot` from `cordova-lib` to `cordova-common`
* [CB-11636](https://issues.apache.org/jira/browse/CB-11636) Handle attributes with quotes correctly
* [CB-11645](https://issues.apache.org/jira/browse/CB-11645) added check to see if `getEditConfig` exists before trying to use it
* [CB-9825](https://issues.apache.org/jira/browse/CB-9825) framework tag spec parsing
### 1.3.0 (May 12, 2016)
* [CB-11259](https://issues.apache.org/jira/browse/CB-11259): Improving prepare and build logging

View File

@ -27,6 +27,7 @@ addProperty(module, 'superspawn', './src/superspawn');
addProperty(module, 'ActionStack', './src/ActionStack');
addProperty(module, 'CordovaError', './src/CordovaError/CordovaError');
addProperty(module, 'CordovaLogger', './src/CordovaLogger');
addProperty(module, 'CordovaCheck', './src/CordovaCheck');
addProperty(module, 'CordovaExternalToolErrorContext', './src/CordovaError/CordovaExternalToolErrorContext');
addProperty(module, 'PlatformJson', './src/PlatformJson');
addProperty(module, 'ConfigParser', './src/ConfigParser/ConfigParser');

View File

@ -14,20 +14,20 @@
]
],
"_from": "cordova-common@>=1.4.0 <2.0.0",
"_id": "cordova-common@1.4.0",
"_id": "cordova-common@1.4.1",
"_inCache": true,
"_installable": true,
"_location": "/cordova-common",
"_nodeVersion": "6.3.0",
"_nodeVersion": "6.2.2",
"_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/cordova-common-1.4.0.tgz_1469092638680_0.9961137105710804"
"tmp": "tmp/cordova-common-1.4.1.tgz_1471306335501_0.6723270947113633"
},
"_npmUser": {
"name": "kotikov.vladimir",
"email": "kotikov.vladimir@gmail.com"
"name": "stevegill",
"email": "stevengill97@gmail.com"
},
"_npmVersion": "3.10.5",
"_npmVersion": "3.9.5",
"_phantomChildren": {},
"_requested": {
"raw": "cordova-common@^1.4.0",
@ -41,8 +41,8 @@
"_requiredBy": [
"/"
],
"_resolved": "http://registry.npmjs.org/cordova-common/-/cordova-common-1.4.0.tgz",
"_shasum": "b3ba73595caa34fe8250ac11f20a4ed44e7c84e4",
"_resolved": "file:cordova-dist-dev/CB-11690/cordova-common-1.4.1.tgz",
"_shasum": "8b4f07b3199b398fff553b32bff66676ecd30ab9",
"_shrinkwrap": null,
"_spec": "cordova-common@^1.4.0",
"_where": "/Users/steveng/repo/cordova/cordova-android",
@ -79,8 +79,8 @@
},
"directories": {},
"dist": {
"shasum": "b3ba73595caa34fe8250ac11f20a4ed44e7c84e4",
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.4.0.tgz"
"shasum": "8b4f07b3199b398fff553b32bff66676ecd30ab9",
"tarball": "https://registry.npmjs.org/cordova-common/-/cordova-common-1.4.1.tgz"
},
"engineStrict": true,
"engines": {
@ -127,5 +127,5 @@
"jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec",
"test": "npm run jshint && npm run jasmine"
},
"version": "1.4.0"
"version": "1.4.1"
}

View File

@ -97,7 +97,10 @@ function remove_plugin_changes(pluginInfo, is_top_level) {
var plugin_vars = is_top_level ?
platform_config.installed_plugins[pluginInfo.id] :
platform_config.dependent_plugins[pluginInfo.id];
var edit_config_changes = pluginInfo.getEditConfigs(self.platform);
var edit_config_changes = null;
if(pluginInfo.getEditConfigs) {
edit_config_changes = pluginInfo.getEditConfigs(self.platform);
}
// get config munge, aka how did this plugin change various config files
var config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
@ -131,7 +134,12 @@ PlatformMunger.prototype.add_plugin_changes = add_plugin_changes;
function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increment, plugin_force) {
var self = this;
var platform_config = self.platformJson.root;
var edit_config_changes = pluginInfo.getEditConfigs(self.platform);
var edit_config_changes = null;
if(pluginInfo.getEditConfigs) {
edit_config_changes = pluginInfo.getEditConfigs(self.platform);
}
var config_munge;
if (!edit_config_changes || edit_config_changes.length === 0) {

View File

@ -90,20 +90,24 @@ function findElementAttributeValue(attributeName, elems) {
}
ConfigParser.prototype = {
getAttribute: function(attr) {
return this.doc.getroot().attrib[attr];
},
packageName: function(id) {
return this.doc.getroot().attrib['id'];
return this.getAttribute('id');
},
setPackageName: function(id) {
this.doc.getroot().attrib['id'] = id;
},
android_packageName: function() {
return this.doc.getroot().attrib['android-packageName'];
return this.getAttribute('android-packageName');
},
android_activityName: function() {
return this.doc.getroot().attrib['android-activityName'];
return this.getAttribute('android-activityName');
},
ios_CFBundleIdentifier: function() {
return this.doc.getroot().attrib['ios-CFBundleIdentifier'];
return this.getAttribute('ios-CFBundleIdentifier');
},
name: function() {
return getNodeTextSafe(this.doc.find('name'));
@ -120,16 +124,16 @@ ConfigParser.prototype = {
el.text = text;
},
version: function() {
return this.doc.getroot().attrib['version'];
return this.getAttribute('version');
},
windows_packageVersion: function() {
return this.doc.getroot().attrib('windows-packageVersion');
return this.getAttribute('windows-packageVersion');
},
android_versionCode: function() {
return this.doc.getroot().attrib['android-versionCode'];
return this.getAttribute('android-versionCode');
},
ios_CFBundleVersion: function() {
return this.doc.getroot().attrib['ios-CFBundleVersion'];
return this.getAttribute('ios-CFBundleVersion');
},
setVersion: function(value) {
this.doc.getroot().attrib['version'] = value;

76
node_modules/cordova-common/src/CordovaCheck.js generated vendored Normal file
View File

@ -0,0 +1,76 @@
/**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
var fs = require('fs'),
path = require('path');
function isRootDir(dir) {
if (fs.existsSync(path.join(dir, 'www'))) {
if (fs.existsSync(path.join(dir, 'config.xml'))) {
// For sure is.
if (fs.existsSync(path.join(dir, 'platforms'))) {
return 2;
} else {
return 1;
}
}
// Might be (or may be under platforms/).
if (fs.existsSync(path.join(dir, 'www', 'config.xml'))) {
return 1;
}
}
return 0;
}
// Runs up the directory chain looking for a .cordova directory.
// IF it is found we are in a Cordova project.
// Omit argument to use CWD.
function isCordova(dir) {
if (!dir) {
// Prefer PWD over cwd so that symlinked dirs within your PWD work correctly (CB-5687).
var pwd = process.env.PWD;
var cwd = process.cwd();
if (pwd && pwd != cwd && pwd != 'undefined') {
return isCordova(pwd) || isCordova(cwd);
}
return isCordova(cwd);
}
var bestReturnValueSoFar = false;
for (var i = 0; i < 1000; ++i) {
var result = isRootDir(dir);
if (result === 2) {
return dir;
}
if (result === 1) {
bestReturnValueSoFar = dir;
}
var parentDir = path.normalize(path.join(dir, '..'));
// Detect fs root.
if (parentDir == dir) {
return bestReturnValueSoFar;
}
dir = parentDir;
}
console.error('Hit an unhandled case in CordovaCheck.isCordova');
return false;
}
module.exports = {
findProjectRoot : isCordova
};

View File

@ -318,6 +318,7 @@ function PluginInfo(dirname) {
parent: el.attrib.parent,
custom: isStrTrue(el.attrib.custom),
src: el.attrib.src,
spec: el.attrib.spec,
weak: isStrTrue(el.attrib.weak),
versions: el.attrib.versions,
targetDir: el.attrib['target-dir'],

View File

@ -44,23 +44,9 @@ module.exports = {
return false;
}
var oneAttribKeys = Object.keys(one.attrib),
twoAttribKeys = Object.keys(two.attrib),
i = 0, attribName;
if (!attribMatch(one, two)) return false;
if (oneAttribKeys.length != twoAttribKeys.length) {
return false;
}
for (i; i < oneAttribKeys.length; i++) {
attribName = oneAttribKeys[i];
if (one.attrib[attribName] != two.attrib[attribName]) {
return false;
}
}
for (i; i < one._children.length; i++) {
for (var i = 0; i < one._children.length; i++) {
if (!module.exports.equalNodes(one._children[i], two._children[i])) {
return false;
}
@ -287,33 +273,30 @@ function mergeXml(src, dest, platform, clobber) {
query = srcTag + '',
shouldMerge = true;
if (BLACKLIST.indexOf(srcTag) === -1) {
if (SINGLETONS.indexOf(srcTag) !== -1) {
foundChild = dest.find(query);
if (foundChild) {
destChild = foundChild;
dest.remove(destChild);
}
} else {
//Check for an exact match and if you find one don't add
Object.getOwnPropertyNames(srcChild.attrib).forEach(function (attribute) {
query += '[@' + attribute + '="' + srcChild.attrib[attribute] + '"]';
});
var foundChildren = dest.findall(query);
for(var i = 0; i < foundChildren.length; i++) {
foundChild = foundChildren[i];
if (foundChild && textMatch(srcChild, foundChild) && (Object.keys(srcChild.attrib).length==Object.keys(foundChild.attrib).length)) {
destChild = foundChild;
dest.remove(destChild);
shouldMerge = false;
break;
}
}
}
if (BLACKLIST.indexOf(srcTag) !== -1) return;
mergeXml(srcChild, destChild, platform, clobber && shouldMerge);
dest.append(destChild);
if (SINGLETONS.indexOf(srcTag) !== -1) {
foundChild = dest.find(query);
if (foundChild) {
destChild = foundChild;
dest.remove(destChild);
}
} else {
//Check for an exact match and if you find one don't add
var mergeCandidates = dest.findall(query)
.filter(function (foundChild) {
return foundChild && textMatch(srcChild, foundChild) && attribMatch(srcChild, foundChild);
});
if (mergeCandidates.length > 0) {
destChild = mergeCandidates[0];
dest.remove(destChild);
shouldMerge = false;
}
}
mergeXml(srcChild, destChild, platform, clobber && shouldMerge);
dest.append(destChild);
}
function removeDuplicatePreferences(xml) {
@ -345,3 +328,22 @@ function textMatch(elm1, elm2) {
text2 = elm2.text ? elm2.text.replace(/\s+/, '') : '';
return (text1 === '' || text1 === text2);
}
function attribMatch(one, two) {
var oneAttribKeys = Object.keys(one.attrib);
var twoAttribKeys = Object.keys(two.attrib);
if (oneAttribKeys.length != twoAttribKeys.length) {
return false;
}
for (var i = 0; i < oneAttribKeys.length; i++) {
var attribName = oneAttribKeys[i];
if (one.attrib[attribName] != two.attrib[attribName]) {
return false;
}
}
return true;
}

39
node_modules/minimatch/minimatch.js generated vendored
View File

@ -9,6 +9,14 @@ try {
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
var expand = require('brace-expansion')
var plTypes = {
'!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
'?': { open: '(?:', close: ')?' },
'+': { open: '(?:', close: ')+' },
'*': { open: '(?:', close: ')*' },
'@': { open: '(?:', close: ')' }
}
// any single thing other than /
// don't need to escape / when using new RegExp()
var qmark = '[^/]'
@ -277,7 +285,6 @@ function parse (pattern, isSub) {
// ? => one single character
var patternListStack = []
var negativeLists = []
var plType
var stateChar
var inClass = false
var reClassStart = -1
@ -376,11 +383,12 @@ function parse (pattern, isSub) {
continue
}
plType = stateChar
patternListStack.push({
type: plType,
type: stateChar,
start: i - 1,
reStart: re.length
reStart: re.length,
open: plTypes[stateChar].open,
close: plTypes[stateChar].close
})
// negation is (?:(?!js)[^/]*)
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
@ -396,24 +404,14 @@ function parse (pattern, isSub) {
clearStateChar()
hasMagic = true
re += ')'
var pl = patternListStack.pop()
plType = pl.type
// negation is (?:(?!js)[^/]*)
// The others are (?:<pattern>)<type>
switch (plType) {
case '!':
negativeLists.push(pl)
re += ')[^/]*?)'
pl.reEnd = re.length
break
case '?':
case '+':
case '*':
re += plType
break
case '@': break // the default anyway
re += pl.close
if (pl.type === '!') {
negativeLists.push(pl)
}
pl.reEnd = re.length
continue
case '|':
@ -520,7 +518,8 @@ function parse (pattern, isSub) {
// Go through and escape them, taking care not to double-escape any
// | chars that were already escaped.
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
var tail = re.slice(pl.reStart + 3)
var tail = re.slice(pl.reStart + pl.open.length)
this.debug('setting tail', re, pl)
// maybe some even number of \, then maybe 1 \, followed by a |
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
if (!$2) {
@ -537,7 +536,7 @@ function parse (pattern, isSub) {
return $1 + $1 + $2 + '|'
})
this.debug('tail=%j\n %s', tail, tail)
this.debug('tail=%j\n %s', tail, tail, pl, re)
var t = pl.type === '*' ? star
: pl.type === '?' ? qmark
: '\\' + pl.type

20
node_modules/minimatch/package.json generated vendored
View File

@ -14,20 +14,20 @@
]
],
"_from": "minimatch@>=3.0.0 <4.0.0",
"_id": "minimatch@3.0.2",
"_id": "minimatch@3.0.3",
"_inCache": true,
"_installable": true,
"_location": "/minimatch",
"_nodeVersion": "4.4.4",
"_npmOperationalInternal": {
"host": "packages-16-east.internal.npmjs.com",
"tmp": "tmp/minimatch-3.0.2.tgz_1466194379770_0.11417287751100957"
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/minimatch-3.0.3.tgz_1470678322731_0.1892083385027945"
},
"_npmUser": {
"name": "isaacs",
"email": "i@izs.me"
},
"_npmVersion": "3.9.1",
"_npmVersion": "3.10.6",
"_phantomChildren": {},
"_requested": {
"raw": "minimatch@^3.0.0",
@ -42,8 +42,8 @@
"/cordova-common",
"/glob"
],
"_resolved": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.2.tgz",
"_shasum": "0f398a7300ea441e9c348c83d98ab8c9dbf9c40a",
"_resolved": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz",
"_shasum": "2a4e4090b96b2db06a9d7df01055a62a77c9b774",
"_shrinkwrap": null,
"_spec": "minimatch@^3.0.0",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/cordova-common",
@ -65,8 +65,8 @@
},
"directories": {},
"dist": {
"shasum": "0f398a7300ea441e9c348c83d98ab8c9dbf9c40a",
"tarball": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.2.tgz"
"shasum": "2a4e4090b96b2db06a9d7df01055a62a77c9b774",
"tarball": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz"
},
"engines": {
"node": "*"
@ -74,7 +74,7 @@
"files": [
"minimatch.js"
],
"gitHead": "81edb7c763abd31ba981c87ec5e835f178786be0",
"gitHead": "eed89491bd4a4e6bc463aac0dfb5c29ef0d1dc13",
"homepage": "https://github.com/isaacs/minimatch#readme",
"license": "ISC",
"main": "minimatch.js",
@ -95,5 +95,5 @@
"posttest": "standard minimatch.js test/*.js",
"test": "tap test/*.js"
},
"version": "3.0.2"
"version": "3.0.3"
}