mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 20:33:07 +08:00
updated node_modules
This commit is contained in:
parent
3abd12aee3
commit
4f7721b405
48
node_modules/cordova-common/.jscs.json
generated
vendored
48
node_modules/cordova-common/.jscs.json
generated
vendored
@ -1,24 +1,24 @@
|
|||||||
{
|
{
|
||||||
"disallowMixedSpacesAndTabs": true,
|
"disallowMixedSpacesAndTabs": true,
|
||||||
"disallowTrailingWhitespace": true,
|
"disallowTrailingWhitespace": true,
|
||||||
"validateLineBreaks": "LF",
|
"validateLineBreaks": "LF",
|
||||||
"validateIndentation": 4,
|
"validateIndentation": 4,
|
||||||
"requireLineFeedAtFileEnd": true,
|
"requireLineFeedAtFileEnd": true,
|
||||||
|
|
||||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||||
"disallowSpaceBeforePostfixUnaryOperators": true,
|
"disallowSpaceBeforePostfixUnaryOperators": true,
|
||||||
"requireSpaceAfterLineComment": true,
|
"requireSpaceAfterLineComment": true,
|
||||||
"requireCapitalizedConstructors": true,
|
"requireCapitalizedConstructors": true,
|
||||||
|
|
||||||
"disallowSpacesInNamedFunctionExpression": {
|
"disallowSpacesInNamedFunctionExpression": {
|
||||||
"beforeOpeningRoundBrace": true
|
"beforeOpeningRoundBrace": true
|
||||||
},
|
},
|
||||||
|
|
||||||
"requireSpaceAfterKeywords": [
|
"requireSpaceAfterKeywords": [
|
||||||
"if",
|
"if",
|
||||||
"else",
|
"else",
|
||||||
"for",
|
"for",
|
||||||
"while",
|
"while",
|
||||||
"do"
|
"do"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
2
node_modules/cordova-common/.jshintignore
generated
vendored
2
node_modules/cordova-common/.jshintignore
generated
vendored
@ -1 +1 @@
|
|||||||
spec/fixtures/*
|
spec/fixtures/*
|
||||||
|
4
node_modules/cordova-common/.npmignore
generated
vendored
4
node_modules/cordova-common/.npmignore
generated
vendored
@ -1,2 +1,2 @@
|
|||||||
spec
|
spec
|
||||||
coverage
|
coverage
|
||||||
|
4
node_modules/cordova-common/.ratignore
generated
vendored
4
node_modules/cordova-common/.ratignore
generated
vendored
@ -1,2 +1,2 @@
|
|||||||
fixtures
|
fixtures
|
||||||
coverage
|
coverage
|
||||||
|
182
node_modules/cordova-common/README.md
generated
vendored
182
node_modules/cordova-common/README.md
generated
vendored
@ -1,33 +1,149 @@
|
|||||||
<!--
|
<!--
|
||||||
#
|
#
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
# or more contributor license agreements. See the NOTICE file
|
# or more contributor license agreements. See the NOTICE file
|
||||||
# distributed with this work for additional information
|
# distributed with this work for additional information
|
||||||
# regarding copyright ownership. The ASF licenses this file
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
# to you under the Apache License, Version 2.0 (the
|
# to you under the Apache License, Version 2.0 (the
|
||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing,
|
# Unless required by applicable law or agreed to in writing,
|
||||||
# software distributed under the License is distributed on an
|
# software distributed under the License is distributed on an
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# cordova-common
|
# cordova-common
|
||||||
Contains shared classes and routines used by [cordova-lib](https://github.com/apache/cordova-lib/) and platforms.
|
Expoeses shared functionality used by [cordova-lib](https://github.com/apache/cordova-lib/) and Cordova platforms.
|
||||||
|
## Exposed APIs
|
||||||
## Setup
|
|
||||||
* Clone this repository onto your local machine.
|
### `events`
|
||||||
`git clone https://git-wip-us.apache.org/repos/asf/cordova-lib.git`
|
|
||||||
* In terminal, navigate to the inner cordova-common directory.
|
Represents special instance of NodeJS EventEmitter which is intended to be used to post events to cordova-lib and cordova-cli
|
||||||
`cd cordova-lib/cordova-common`
|
|
||||||
* Install dependencies and npm-link
|
Usage:
|
||||||
`npm install && npm link`
|
```
|
||||||
* Navigate to cordova-lib directory and link cordova-common
|
var events = require('cordova-common').events;
|
||||||
`cd ../cordova-lib && npm link cordova-common && npm install`
|
events.emit('warn', 'Some warning message')
|
||||||
|
```
|
||||||
|
|
||||||
|
There are the following events supported by cordova-cli: `verbose`, `log`, `info`, `warn`, `error`.
|
||||||
|
|
||||||
|
### `CordovaError`
|
||||||
|
|
||||||
|
An error class used by Cordova to throw cordova-specific errors. The CordovaError class is inherited from Error, so CordovaError instances is also valid Error instances (`instanceof` check succeeds).
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```
|
||||||
|
var CordovaError = require('cordova-common').CordovaError;
|
||||||
|
throw new CordovaError('Some error message', SOME_ERR_CODE);
|
||||||
|
```
|
||||||
|
|
||||||
|
See [CordovaError](src/CordovaError/CordovaError.js) for supported error codes.
|
||||||
|
|
||||||
|
### `ConfigParser`
|
||||||
|
|
||||||
|
Exposes functionality to deal with cordova project `config.xml` files. For ConfigParser API reference check [ConfigParser Readme](src/ConfigParser/README.md).
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```
|
||||||
|
var ConfigParser = require('cordova-common').ConfigParser;
|
||||||
|
var appConfig = new ConfigParser('path/to/cordova-app/config.xml');
|
||||||
|
console.log(appconfig.name() + ':' + appConfig.version());
|
||||||
|
```
|
||||||
|
|
||||||
|
### `PluginInfoProvider` and `PluginInfo`
|
||||||
|
|
||||||
|
`PluginInfo` is a wrapper for cordova plugins' `plugin.xml` files. This class may be instantiated directly or via `PluginInfoProvider`. The difference is that `PluginInfoProvider` caches `PluginInfo` instances based on plugin source directory.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```
|
||||||
|
var PluginInfo: require('cordova-common').PluginInfo;
|
||||||
|
var PluginInfoProvider: require('cordova-common').PluginInfoProvider;
|
||||||
|
|
||||||
|
// The following instances are equal
|
||||||
|
var plugin1 = new PluginInfo('path/to/plugin_directory');
|
||||||
|
var plugin2 = new PluginInfoProvider().get('path/to/plugin_directory');
|
||||||
|
|
||||||
|
console.log('The plugin ' + plugin1.id + ' has version ' + plugin1.version)
|
||||||
|
```
|
||||||
|
|
||||||
|
### `ActionStack`
|
||||||
|
|
||||||
|
Utility module for dealing with sequential tasks. Provides a set of tasks that are needed to be done and reverts all tasks that are already completed if one of those tasks fail to complete. Used internally by cordova-lib and platform's plugin installation routines.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```
|
||||||
|
var ActionStack = require('cordova-common').ActionStack;
|
||||||
|
var stack = new ActionStack()
|
||||||
|
|
||||||
|
var action1 = stack.createAction(task1, [<task parameters>], task1_reverter, [<reverter_parameters>]);
|
||||||
|
var action2 = stack.createAction(task2, [<task parameters>], task2_reverter, [<reverter_parameters>]);
|
||||||
|
|
||||||
|
stack.push(action1);
|
||||||
|
stack.push(action2);
|
||||||
|
|
||||||
|
stack.process()
|
||||||
|
.then(function() {
|
||||||
|
// all actions succeded
|
||||||
|
})
|
||||||
|
.catch(function(error){
|
||||||
|
// One of actions failed with error
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### `superspawn`
|
||||||
|
|
||||||
|
Module for spawning child processes with some advanced logic.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```
|
||||||
|
var superspawn = require('cordova-common').superspawn;
|
||||||
|
superspawn.spawn('adb', ['devices'])
|
||||||
|
.then(function(devices){
|
||||||
|
// Do something...
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### `xmlHelpers`
|
||||||
|
|
||||||
|
A set of utility methods for dealing with xml files.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
```
|
||||||
|
var xml = require('cordova-common').xmlHelpers;
|
||||||
|
|
||||||
|
var xmlDoc1 = xml.parseElementtreeSync('some/xml/file');
|
||||||
|
var xmlDoc2 = xml.parseElementtreeSync('another/xml/file');
|
||||||
|
|
||||||
|
xml.mergeXml(doc1, doc2); // doc2 now contains all the nodes from doc1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Other APIs
|
||||||
|
|
||||||
|
The APIs listed below are also exposed but are intended to be only used internally by cordova plugin installation routines.
|
||||||
|
|
||||||
|
```
|
||||||
|
PlatformJson
|
||||||
|
ConfigChanges
|
||||||
|
ConfigKeeper
|
||||||
|
ConfigFile
|
||||||
|
mungeUtil
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
* Clone this repository onto your local machine
|
||||||
|
`git clone https://git-wip-us.apache.org/repos/asf/cordova-lib.git`
|
||||||
|
* In terminal, navigate to the inner cordova-common directory
|
||||||
|
`cd cordova-lib/cordova-common`
|
||||||
|
* Install dependencies and npm-link
|
||||||
|
`npm install && npm link`
|
||||||
|
* Navigate to cordova-lib directory and link cordova-common
|
||||||
|
`cd ../cordova-lib && npm link cordova-common && npm install`
|
||||||
|
5
node_modules/cordova-common/RELEASENOTES.md
generated
vendored
5
node_modules/cordova-common/RELEASENOTES.md
generated
vendored
@ -20,7 +20,9 @@
|
|||||||
-->
|
-->
|
||||||
# Cordova-common Release Notes
|
# Cordova-common Release Notes
|
||||||
|
|
||||||
### 0.1.0 (Oct, 2015)
|
### 1.0.0 (Oct 29, 2015)
|
||||||
|
|
||||||
|
* CB-9890 Documents cordova-common
|
||||||
* CB-9598 Correct cordova-lib -> cordova-common in README
|
* CB-9598 Correct cordova-lib -> cordova-common in README
|
||||||
* Pick ConfigParser changes from apache@0c3614e
|
* Pick ConfigParser changes from apache@0c3614e
|
||||||
* CB-9743 Removes system frameworks handling from ConfigChanges
|
* CB-9743 Removes system frameworks handling from ConfigChanges
|
||||||
@ -29,3 +31,4 @@
|
|||||||
* Picking CordovaError changes from apache@a3b1fca
|
* Picking CordovaError changes from apache@a3b1fca
|
||||||
* CB-9598 Adds tests and fixtures based on existing cordova-lib ones
|
* CB-9598 Adds tests and fixtures based on existing cordova-lib ones
|
||||||
* CB-9598 Initial implementation for cordova-common
|
* CB-9598 Initial implementation for cordova-common
|
||||||
|
|
||||||
|
84
node_modules/cordova-common/cordova-common.js
generated
vendored
84
node_modules/cordova-common/cordova-common.js
generated
vendored
@ -1,42 +1,42 @@
|
|||||||
/**
|
/**
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint node:true */
|
/* jshint node:true */
|
||||||
|
|
||||||
// For now expose plugman and cordova just as they were in the old repos
|
// For now expose plugman and cordova just as they were in the old repos
|
||||||
exports = module.exports = {
|
exports = module.exports = {
|
||||||
events: require('./src/events'),
|
events: require('./src/events'),
|
||||||
superspawn: require('./src/superspawn'),
|
superspawn: require('./src/superspawn'),
|
||||||
|
|
||||||
ActionStack: require('./src/ActionStack'),
|
ActionStack: require('./src/ActionStack'),
|
||||||
CordovaError: require('./src/CordovaError/CordovaError'),
|
CordovaError: require('./src/CordovaError/CordovaError'),
|
||||||
CordovaExternalToolErrorContext: require('./src/CordovaError/CordovaExternalToolErrorContext'),
|
CordovaExternalToolErrorContext: require('./src/CordovaError/CordovaExternalToolErrorContext'),
|
||||||
PlatformJson: require('./src/PlatformJson'),
|
PlatformJson: require('./src/PlatformJson'),
|
||||||
ConfigParser: require('./src/ConfigParser/ConfigParser.js'),
|
ConfigParser: require('./src/ConfigParser/ConfigParser.js'),
|
||||||
|
|
||||||
PluginInfo: require('./src/PluginInfo/PluginInfo.js'),
|
PluginInfo: require('./src/PluginInfo/PluginInfo.js'),
|
||||||
PluginInfoProvider: require('./src/PluginInfo/PluginInfoProvider.js'),
|
PluginInfoProvider: require('./src/PluginInfo/PluginInfoProvider.js'),
|
||||||
|
|
||||||
ConfigChanges: require('./src/ConfigChanges/ConfigChanges.js'),
|
ConfigChanges: require('./src/ConfigChanges/ConfigChanges.js'),
|
||||||
ConfigKeeper: require('./src/ConfigChanges/ConfigKeeper.js'),
|
ConfigKeeper: require('./src/ConfigChanges/ConfigKeeper.js'),
|
||||||
ConfigFile: require('./src/ConfigChanges/ConfigFile.js'),
|
ConfigFile: require('./src/ConfigChanges/ConfigFile.js'),
|
||||||
mungeUtil: require('./src/ConfigChanges/munge-util.js'),
|
mungeUtil: require('./src/ConfigChanges/munge-util.js'),
|
||||||
|
|
||||||
xmlHelpers: require('./src/util/xml-helpers')
|
xmlHelpers: require('./src/util/xml-helpers')
|
||||||
};
|
};
|
||||||
|
24
node_modules/cordova-common/node_modules/bplist-parser/package.json
generated
vendored
24
node_modules/cordova-common/node_modules/bplist-parser/package.json
generated
vendored
@ -23,30 +23,14 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/nearinfinity/node-bplist-parser.git"
|
"url": "git+https://github.com/nearinfinity/node-bplist-parser.git"
|
||||||
},
|
},
|
||||||
"gitHead": "82d14f8defa7fc1e9f78a469c76c235ac244fd8f",
|
"readme": "bplist-parser\n=============\n\nBinary Mac OS X Plist (property list) parser.\n\n## Installation\n\n```bash\n$ npm install bplist-parser\n```\n\n## Quick Examples\n\n```javascript\nvar bplist = require('bplist-parser');\n\nbplist.parseFile('myPlist.bplist', function(err, obj) {\n if (err) throw err;\n\n console.log(JSON.stringify(obj));\n});\n```\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 Near Infinity Corporation\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nearinfinity/node-bplist-parser/issues"
|
"url": "https://github.com/nearinfinity/node-bplist-parser/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/nearinfinity/node-bplist-parser",
|
"homepage": "https://github.com/nearinfinity/node-bplist-parser#readme",
|
||||||
"_id": "bplist-parser@0.1.0",
|
"_id": "bplist-parser@0.1.0",
|
||||||
"_shasum": "630823f2056437d4dbefc20e84017f8bac48e008",
|
"_shasum": "630823f2056437d4dbefc20e84017f8bac48e008",
|
||||||
"_from": "bplist-parser@>=0.1.0 <0.2.0",
|
|
||||||
"_npmVersion": "1.4.14",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "joeferner",
|
|
||||||
"email": "joe@fernsroth.com"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "joeferner",
|
|
||||||
"email": "joe@fernsroth.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dist": {
|
|
||||||
"shasum": "630823f2056437d4dbefc20e84017f8bac48e008",
|
|
||||||
"tarball": "http://registry.npmjs.org/bplist-parser/-/bplist-parser-0.1.0.tgz"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"_resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.1.0.tgz",
|
"_resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.1.0.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"_from": "bplist-parser@>=0.1.0 <0.2.0"
|
||||||
}
|
}
|
||||||
|
19
node_modules/cordova-common/node_modules/cordova-registry-mapper/index.js
generated
vendored
19
node_modules/cordova-common/node_modules/cordova-registry-mapper/index.js
generated
vendored
@ -138,6 +138,8 @@ var map = {
|
|||||||
'nl.x-services.plugins.toast' : 'cordova-plugin-x-toast',
|
'nl.x-services.plugins.toast' : 'cordova-plugin-x-toast',
|
||||||
'nl.x-services.plugins.calendar' : 'cordova-plugin-calendar',
|
'nl.x-services.plugins.calendar' : 'cordova-plugin-calendar',
|
||||||
'nl.x-services.plugins.launchmyapp' : 'cordova-plugin-customurlscheme',
|
'nl.x-services.plugins.launchmyapp' : 'cordova-plugin-customurlscheme',
|
||||||
|
'nl.x-services.plugins.flashlight' : 'cordova-plugin-flashlight',
|
||||||
|
'nl.x-services.plugins.sslcertificatechecker' : 'cordova-plugin-sslcertificatechecker',
|
||||||
'com.bridge.open' : 'cordova-open',
|
'com.bridge.open' : 'cordova-open',
|
||||||
'com.bridge.safe' : 'cordova-safe',
|
'com.bridge.safe' : 'cordova-safe',
|
||||||
'com.disusered.open' : 'cordova-open',
|
'com.disusered.open' : 'cordova-open',
|
||||||
@ -162,6 +164,7 @@ var map = {
|
|||||||
're.notifica.cordova': 'cordova-plugin-notificare-push',
|
're.notifica.cordova': 'cordova-plugin-notificare-push',
|
||||||
'com.megster.cordova.ble': 'cordova-plugin-ble-central',
|
'com.megster.cordova.ble': 'cordova-plugin-ble-central',
|
||||||
'com.megster.cordova.bluetoothserial': 'cordova-plugin-bluetooth-serial',
|
'com.megster.cordova.bluetoothserial': 'cordova-plugin-bluetooth-serial',
|
||||||
|
'com.megster.cordova.rfduino': 'cordova-plugin-rfduino',
|
||||||
'cz.velda.cordova.plugin.devicefeedback': 'cordova-plugin-velda-devicefeedback',
|
'cz.velda.cordova.plugin.devicefeedback': 'cordova-plugin-velda-devicefeedback',
|
||||||
'cz.Velda.cordova.plugin.devicefeedback': 'cordova-plugin-velda-devicefeedback',
|
'cz.Velda.cordova.plugin.devicefeedback': 'cordova-plugin-velda-devicefeedback',
|
||||||
'org.scriptotek.appinfo': 'cordova-plugin-appinfo',
|
'org.scriptotek.appinfo': 'cordova-plugin-appinfo',
|
||||||
@ -169,7 +172,21 @@ var map = {
|
|||||||
'pl.makingwaves.estimotebeacons': 'cordova-plugin-estimote',
|
'pl.makingwaves.estimotebeacons': 'cordova-plugin-estimote',
|
||||||
'com.evothings.ble': 'cordova-plugin-ble',
|
'com.evothings.ble': 'cordova-plugin-ble',
|
||||||
'com.appsee.plugin' : 'cordova-plugin-appsee',
|
'com.appsee.plugin' : 'cordova-plugin-appsee',
|
||||||
'am.armsoft.plugins.listpicker': 'cordova-plugin-listpicker'
|
'am.armsoft.plugins.listpicker': 'cordova-plugin-listpicker',
|
||||||
|
'com.pushbots.push': 'pushbots-cordova-plugin',
|
||||||
|
'com.admob.google': 'cordova-admob',
|
||||||
|
'admob.ads.google': 'cordova-admob-ads',
|
||||||
|
'admob.google.plugin': 'admob-google',
|
||||||
|
'com.admob.admobads': 'admob-ads',
|
||||||
|
'com.connectivity.monitor': 'cordova-connectivity-monitor',
|
||||||
|
'com.ios.libgoogleadmobads': 'cordova-libgoogleadmobads',
|
||||||
|
'com.google.play.services': 'cordova-google-play-services',
|
||||||
|
'android.support.v13': 'cordova-android-support-v13',
|
||||||
|
'android.support.v4': 'cordova-android-support-v4',
|
||||||
|
'com.analytics.google': 'cordova-plugin-analytics',
|
||||||
|
'com.analytics.adid.google': 'cordova-plugin-analytics-adid',
|
||||||
|
'com.chariotsolutions.nfc.plugin': 'phonegap-nfc',
|
||||||
|
'com.samz.mixpanel': 'cordova-plugin-mixpanel'
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.oldToNew = map;
|
module.exports.oldToNew = map;
|
||||||
|
@ -53,6 +53,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.0.tgz",
|
"_resolved": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.7.0.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
@ -31,30 +31,14 @@
|
|||||||
"url": "http://blog.izs.me/"
|
"url": "http://blog.izs.me/"
|
||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"gitHead": "527f97aa5bb253d927348698c0cd3bb267d098c6",
|
"readme": "# sigmund\n\nQuick and dirty signatures for Objects.\n\nThis is like a much faster `deepEquals` comparison, which returns a\nstring key suitable for caches and the like.\n\n## Usage\n\n```javascript\nfunction doSomething (someObj) {\n var key = sigmund(someObj, maxDepth) // max depth defaults to 10\n var cached = cache.get(key)\n if (cached) return cached\n\n var result = expensiveCalculation(someObj)\n cache.set(key, result)\n return result\n}\n```\n\nThe resulting key will be as unique and reproducible as calling\n`JSON.stringify` or `util.inspect` on the object, but is much faster.\nIn order to achieve this speed, some differences are glossed over.\nFor example, the object `{0:'foo'}` will be treated identically to the\narray `['foo']`.\n\nAlso, just as there is no way to summon the soul from the scribblings\nof a cocaine-addled psychoanalyst, there is no way to revive the object\nfrom the signature string that sigmund gives you. In fact, it's\nbarely even readable.\n\nAs with `util.inspect` and `JSON.stringify`, larger objects will\nproduce larger signature strings.\n\nBecause sigmund is a bit less strict than the more thorough\nalternatives, the strings will be shorter, and also there is a\nslightly higher chance for collisions. For example, these objects\nhave the same signature:\n\n var obj1 = {a:'b',c:/def/,g:['h','i',{j:'',k:'l'}]}\n var obj2 = {a:'b',c:'/def/',g:['h','i','{jkl']}\n\nLike a good Freudian, sigmund is most effective when you already have\nsome understanding of what you're looking for. It can help you help\nyourself, but you must be willing to do some work as well.\n\nCycles are handled, and cyclical objects are silently omitted (though\nthe key is included in the signature output.)\n\nThe second argument is the maximum depth, which defaults to 10,\nbecause that is the maximum object traversal depth covered by most\ninsurance carriers.\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/isaacs/sigmund/issues"
|
"url": "https://github.com/isaacs/sigmund/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/isaacs/sigmund#readme",
|
"homepage": "https://github.com/isaacs/sigmund#readme",
|
||||||
"_id": "sigmund@1.0.1",
|
"_id": "sigmund@1.0.1",
|
||||||
"_shasum": "3ff21f198cad2175f9f3b781853fd94d0d19b590",
|
"_shasum": "3ff21f198cad2175f9f3b781853fd94d0d19b590",
|
||||||
"_from": "sigmund@>=1.0.0 <1.1.0",
|
|
||||||
"_npmVersion": "2.10.0",
|
|
||||||
"_nodeVersion": "2.0.1",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "isaacs@npmjs.com"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "3ff21f198cad2175f9f3b781853fd94d0d19b590",
|
|
||||||
"tarball": "http://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "i@izs.me"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
|
"_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"_from": "sigmund@>=1.0.0 <1.1.0"
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -22,29 +22,14 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node test"
|
"test": "node test"
|
||||||
},
|
},
|
||||||
|
"readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/isaacs/inherits/issues"
|
"url": "https://github.com/isaacs/inherits/issues"
|
||||||
},
|
},
|
||||||
|
"homepage": "https://github.com/isaacs/inherits#readme",
|
||||||
"_id": "inherits@2.0.1",
|
"_id": "inherits@2.0.1",
|
||||||
"dist": {
|
|
||||||
"shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
|
|
||||||
"tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
|
||||||
},
|
|
||||||
"_from": "inherits@>=2.0.1 <2.1.0",
|
|
||||||
"_npmVersion": "1.3.8",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "i@izs.me"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "i@izs.me"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directories": {},
|
|
||||||
"_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
|
"_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
|
||||||
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
||||||
"readme": "ERROR: No README data found!",
|
"_from": "inherits@>=2.0.1 <2.1.0"
|
||||||
"homepage": "https://github.com/isaacs/inherits#readme"
|
|
||||||
}
|
}
|
||||||
|
31
node_modules/cordova-common/node_modules/cordova-registry-mapper/package.json
generated
vendored
31
node_modules/cordova-common/node_modules/cordova-registry-mapper/package.json
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cordova-registry-mapper",
|
"name": "cordova-registry-mapper",
|
||||||
"version": "1.1.12",
|
"version": "1.1.13",
|
||||||
"description": "Maps old plugin ids to new plugin names for fetching from npm",
|
"description": "Maps old plugin ids to new plugin names for fetching from npm",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -21,31 +21,14 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tape": "^3.5.0"
|
"tape": "^3.5.0"
|
||||||
},
|
},
|
||||||
"gitHead": "b20b1953ea792366334cbb55595f4bd3fe5d24f0",
|
"readme": "[](https://travis-ci.org/stevengill/cordova-registry-mapper)\n\n#Cordova Registry Mapper\n\nThis module is used to map Cordova plugin ids to package names and vice versa.\n\nWhen Cordova users add plugins to their projects using ids\n(e.g. `cordova plugin add org.apache.cordova.device`),\nthis module will map that id to the corresponding package name so `cordova-lib` knows what to fetch from **npm**.\n\nThis module was created so the Apache Cordova project could migrate its plugins from\nthe [Cordova Registry](http://registry.cordova.io/)\nto [npm](https://registry.npmjs.com/)\ninstead of having to maintain a registry.\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
|
"gitHead": "f9aedb702a876f1a4d53760bb31a39358e0f261e",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/stevengill/cordova-registry-mapper/issues"
|
"url": "https://github.com/stevengill/cordova-registry-mapper/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/stevengill/cordova-registry-mapper#readme",
|
"homepage": "https://github.com/stevengill/cordova-registry-mapper#readme",
|
||||||
"_id": "cordova-registry-mapper@1.1.12",
|
"_id": "cordova-registry-mapper@1.1.13",
|
||||||
"_shasum": "f0b4f95239a4328766643877e90a95a53815cef1",
|
"_shasum": "08e74b13833abb4bda4b279a0d447590113c8c28",
|
||||||
"_from": "cordova-registry-mapper@>=1.1.8 <2.0.0",
|
"_from": "cordova-registry-mapper@>=1.1.8 <2.0.0"
|
||||||
"_npmVersion": "2.14.2",
|
|
||||||
"_nodeVersion": "0.10.36",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "stevegill",
|
|
||||||
"email": "stevengill97@gmail.com"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "f0b4f95239a4328766643877e90a95a53815cef1",
|
|
||||||
"tarball": "http://registry.npmjs.org/cordova-registry-mapper/-/cordova-registry-mapper-1.1.12.tgz"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "stevegill",
|
|
||||||
"email": "stevengill97@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directories": {},
|
|
||||||
"_resolved": "https://registry.npmjs.org/cordova-registry-mapper/-/cordova-registry-mapper-1.1.12.tgz",
|
|
||||||
"readme": "ERROR: No README data found!"
|
|
||||||
}
|
}
|
||||||
|
31
node_modules/cordova-common/node_modules/glob/node_modules/inflight/package.json
generated
vendored
31
node_modules/cordova-common/node_modules/glob/node_modules/inflight/package.json
generated
vendored
@ -27,35 +27,10 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/isaacs/inflight",
|
"homepage": "https://github.com/isaacs/inflight",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"gitHead": "c7b5531d572a867064d4a1da9e013e8910b7d1ba",
|
"readme": "# inflight\n\nAdd callbacks to requests in flight to avoid async duplication\n\n## USAGE\n\n```javascript\nvar inflight = require('inflight')\n\n// some request that does some stuff\nfunction req(key, callback) {\n // key is any random string. like a url or filename or whatever.\n //\n // will return either a falsey value, indicating that the\n // request for this key is already in flight, or a new callback\n // which when called will call all callbacks passed to inflightk\n // with the same key\n callback = inflight(key, callback)\n\n // If we got a falsey value back, then there's already a req going\n if (!callback) return\n\n // this is where you'd fetch the url or whatever\n // callback is also once()-ified, so it can safely be assigned\n // to multiple events etc. First call wins.\n setTimeout(function() {\n callback(null, key)\n }, 100)\n}\n\n// only assigns a single setTimeout\n// when it dings, all cbs get called\nreq('foo', cb1)\nreq('foo', cb2)\nreq('foo', cb3)\nreq('foo', cb4)\n```\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"_id": "inflight@1.0.4",
|
"_id": "inflight@1.0.4",
|
||||||
"_shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a",
|
"_shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a",
|
||||||
"_from": "inflight@>=1.0.4 <2.0.0",
|
|
||||||
"_npmVersion": "2.1.3",
|
|
||||||
"_nodeVersion": "0.10.32",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "othiym23",
|
|
||||||
"email": "ogd@aoaioxxysz.net"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "i@izs.me"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "othiym23",
|
|
||||||
"email": "ogd@aoaioxxysz.net"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "iarna",
|
|
||||||
"email": "me@re-becca.org"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dist": {
|
|
||||||
"shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a",
|
|
||||||
"tarball": "http://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz",
|
"_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"_from": "inflight@>=1.0.4 <2.0.0"
|
||||||
}
|
}
|
||||||
|
23
node_modules/cordova-common/node_modules/glob/node_modules/inherits/package.json
generated
vendored
23
node_modules/cordova-common/node_modules/glob/node_modules/inherits/package.json
generated
vendored
@ -22,29 +22,14 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node test"
|
"test": "node test"
|
||||||
},
|
},
|
||||||
|
"readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/isaacs/inherits/issues"
|
"url": "https://github.com/isaacs/inherits/issues"
|
||||||
},
|
},
|
||||||
|
"homepage": "https://github.com/isaacs/inherits#readme",
|
||||||
"_id": "inherits@2.0.1",
|
"_id": "inherits@2.0.1",
|
||||||
"dist": {
|
|
||||||
"shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
|
|
||||||
"tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
|
||||||
},
|
|
||||||
"_from": "inherits@>=2.0.0 <3.0.0",
|
|
||||||
"_npmVersion": "1.3.8",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "i@izs.me"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "i@izs.me"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directories": {},
|
|
||||||
"_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
|
"_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1",
|
||||||
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
||||||
"readme": "ERROR: No README data found!",
|
"_from": "inherits@>=2.0.0 <3.0.0"
|
||||||
"homepage": "https://github.com/isaacs/inherits#readme"
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "0.8"
|
|
||||||
- "0.10"
|
- "0.10"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "balanced-match",
|
"name": "balanced-match",
|
||||||
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
"description": "Match balanced character pairs, like \"{\" and \"}\"",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/juliangruber/balanced-match.git"
|
"url": "git://github.com/juliangruber/balanced-match.git"
|
||||||
@ -44,30 +44,30 @@
|
|||||||
"android-browser/4.2..latest"
|
"android-browser/4.2..latest"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"gitHead": "ba40ed78e7114a4a67c51da768a100184dead39c",
|
"gitHead": "d743dd31d7376e0fcf99392a4be7227f2e99bf5d",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/juliangruber/balanced-match/issues"
|
"url": "https://github.com/juliangruber/balanced-match/issues"
|
||||||
},
|
},
|
||||||
"_id": "balanced-match@0.2.0",
|
"_id": "balanced-match@0.2.1",
|
||||||
"_shasum": "38f6730c03aab6d5edbb52bd934885e756d71674",
|
"_shasum": "7bc658b4bed61eee424ad74f75f5c3e2c4df3cc7",
|
||||||
"_from": "balanced-match@>=0.2.0 <0.3.0",
|
"_from": "balanced-match@>=0.2.0 <0.3.0",
|
||||||
"_npmVersion": "2.1.8",
|
"_npmVersion": "2.14.7",
|
||||||
"_nodeVersion": "0.10.32",
|
"_nodeVersion": "4.2.1",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "juliangruber",
|
"name": "juliangruber",
|
||||||
"email": "julian@juliangruber.com"
|
"email": "julian@juliangruber.com"
|
||||||
},
|
},
|
||||||
|
"dist": {
|
||||||
|
"shasum": "7bc658b4bed61eee424ad74f75f5c3e2c4df3cc7",
|
||||||
|
"tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.2.1.tgz"
|
||||||
|
},
|
||||||
"maintainers": [
|
"maintainers": [
|
||||||
{
|
{
|
||||||
"name": "juliangruber",
|
"name": "juliangruber",
|
||||||
"email": "julian@juliangruber.com"
|
"email": "julian@juliangruber.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dist": {
|
|
||||||
"shasum": "38f6730c03aab6d5edbb52bd934885e756d71674",
|
|
||||||
"tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz"
|
|
||||||
},
|
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz",
|
"_resolved": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.2.1.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
"_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b",
|
||||||
"_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
"_resolved": "http://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,6 @@
|
|||||||
"tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.1.tgz"
|
"tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.1.tgz"
|
||||||
},
|
},
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.1.tgz",
|
"_resolved": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.1.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
2
node_modules/cordova-common/node_modules/glob/node_modules/minimatch/package.json
generated
vendored
2
node_modules/cordova-common/node_modules/glob/node_modules/minimatch/package.json
generated
vendored
@ -55,6 +55,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz",
|
"_resolved": "http://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
22
node_modules/cordova-common/node_modules/glob/node_modules/once/package.json
generated
vendored
22
node_modules/cordova-common/node_modules/glob/node_modules/once/package.json
generated
vendored
@ -31,30 +31,14 @@
|
|||||||
"url": "http://blog.izs.me/"
|
"url": "http://blog.izs.me/"
|
||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"gitHead": "e35eed5a7867574e2bf2260a1ba23970958b22f2",
|
"readme": "# once\n\nOnly call a function once.\n\n## usage\n\n```javascript\nvar once = require('once')\n\nfunction load (file, cb) {\n cb = once(cb)\n loader.load('file')\n loader.once('load', cb)\n loader.once('error', cb)\n}\n```\n\nOr add to the Function.prototype in a responsible way:\n\n```javascript\n// only has to be done once\nrequire('once').proto()\n\nfunction load (file, cb) {\n cb = cb.once()\n loader.load('file')\n loader.once('load', cb)\n loader.once('error', cb)\n}\n```\n\nIronically, the prototype feature makes this module twice as\ncomplicated as necessary.\n\nTo check whether you function has been called, use `fn.called`. Once the\nfunction is called for the first time the return value of the original\nfunction is saved in `fn.value` and subsequent calls will continue to\nreturn this value.\n\n```javascript\nvar once = require('once')\n\nfunction load (cb) {\n cb = once(cb)\n var stream = createStream()\n stream.once('data', cb)\n stream.once('end', function () {\n if (!cb.called) cb(new Error('not found'))\n })\n}\n```\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/isaacs/once/issues"
|
"url": "https://github.com/isaacs/once/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/isaacs/once#readme",
|
"homepage": "https://github.com/isaacs/once#readme",
|
||||||
"_id": "once@1.3.2",
|
"_id": "once@1.3.2",
|
||||||
"_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b",
|
"_shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b",
|
||||||
"_from": "once@>=1.3.0 <2.0.0",
|
|
||||||
"_npmVersion": "2.9.1",
|
|
||||||
"_nodeVersion": "2.0.0",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "isaacs@npmjs.com"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "d8feeca93b039ec1dcdee7741c92bdac5e28081b",
|
|
||||||
"tarball": "http://registry.npmjs.org/once/-/once-1.3.2.tgz"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "i@izs.me"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz",
|
"_resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"_from": "once@>=1.3.0 <2.0.0"
|
||||||
}
|
}
|
||||||
|
15
node_modules/cordova-common/node_modules/glob/node_modules/wrappy/LICENSE
generated
vendored
15
node_modules/cordova-common/node_modules/glob/node_modules/wrappy/LICENSE
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
The ISC License
|
|
||||||
|
|
||||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
||||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
36
node_modules/cordova-common/node_modules/glob/node_modules/wrappy/README.md
generated
vendored
36
node_modules/cordova-common/node_modules/glob/node_modules/wrappy/README.md
generated
vendored
@ -1,36 +0,0 @@
|
|||||||
# wrappy
|
|
||||||
|
|
||||||
Callback wrapping utility
|
|
||||||
|
|
||||||
## USAGE
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var wrappy = require("wrappy")
|
|
||||||
|
|
||||||
// var wrapper = wrappy(wrapperFunction)
|
|
||||||
|
|
||||||
// make sure a cb is called only once
|
|
||||||
// See also: http://npm.im/once for this specific use case
|
|
||||||
var once = wrappy(function (cb) {
|
|
||||||
var called = false
|
|
||||||
return function () {
|
|
||||||
if (called) return
|
|
||||||
called = true
|
|
||||||
return cb.apply(this, arguments)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
function printBoo () {
|
|
||||||
console.log('boo')
|
|
||||||
}
|
|
||||||
// has some rando property
|
|
||||||
printBoo.iAmBooPrinter = true
|
|
||||||
|
|
||||||
var onlyPrintOnce = once(printBoo)
|
|
||||||
|
|
||||||
onlyPrintOnce() // prints 'boo'
|
|
||||||
onlyPrintOnce() // does nothing
|
|
||||||
|
|
||||||
// random property is retained!
|
|
||||||
assert.equal(onlyPrintOnce.iAmBooPrinter, true)
|
|
||||||
```
|
|
52
node_modules/cordova-common/node_modules/glob/node_modules/wrappy/package.json
generated
vendored
52
node_modules/cordova-common/node_modules/glob/node_modules/wrappy/package.json
generated
vendored
@ -1,52 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "wrappy",
|
|
||||||
"version": "1.0.1",
|
|
||||||
"description": "Callback wrapping utility",
|
|
||||||
"main": "wrappy.js",
|
|
||||||
"directories": {
|
|
||||||
"test": "test"
|
|
||||||
},
|
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
|
||||||
"tap": "^0.4.12"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "tap test/*.js"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/npm/wrappy.git"
|
|
||||||
},
|
|
||||||
"author": {
|
|
||||||
"name": "Isaac Z. Schlueter",
|
|
||||||
"email": "i@izs.me",
|
|
||||||
"url": "http://blog.izs.me/"
|
|
||||||
},
|
|
||||||
"license": "ISC",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/npm/wrappy/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/npm/wrappy",
|
|
||||||
"gitHead": "006a8cbac6b99988315834c207896eed71fd069a",
|
|
||||||
"_id": "wrappy@1.0.1",
|
|
||||||
"_shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739",
|
|
||||||
"_from": "wrappy@1.0.1",
|
|
||||||
"_npmVersion": "2.0.0",
|
|
||||||
"_nodeVersion": "0.10.31",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "i@izs.me"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "isaacs",
|
|
||||||
"email": "i@izs.me"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dist": {
|
|
||||||
"shasum": "1e65969965ccbc2db4548c6b84a6f2c5aedd4739",
|
|
||||||
"tarball": "http://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
|
|
||||||
},
|
|
||||||
"_resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz",
|
|
||||||
"readme": "ERROR: No README data found!"
|
|
||||||
}
|
|
33
node_modules/cordova-common/node_modules/glob/node_modules/wrappy/wrappy.js
generated
vendored
33
node_modules/cordova-common/node_modules/glob/node_modules/wrappy/wrappy.js
generated
vendored
@ -1,33 +0,0 @@
|
|||||||
// Returns a wrapper function that returns a wrapped callback
|
|
||||||
// The wrapper function should do some stuff, and return a
|
|
||||||
// presumably different callback function.
|
|
||||||
// This makes sure that own properties are retained, so that
|
|
||||||
// decorations and such are not lost along the way.
|
|
||||||
module.exports = wrappy
|
|
||||||
function wrappy (fn, cb) {
|
|
||||||
if (fn && cb) return wrappy(fn)(cb)
|
|
||||||
|
|
||||||
if (typeof fn !== 'function')
|
|
||||||
throw new TypeError('need wrapper function')
|
|
||||||
|
|
||||||
Object.keys(fn).forEach(function (k) {
|
|
||||||
wrapper[k] = fn[k]
|
|
||||||
})
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
function wrapper() {
|
|
||||||
var args = new Array(arguments.length)
|
|
||||||
for (var i = 0; i < args.length; i++) {
|
|
||||||
args[i] = arguments[i]
|
|
||||||
}
|
|
||||||
var ret = fn.apply(this, args)
|
|
||||||
var cb = args[args.length-1]
|
|
||||||
if (typeof ret === 'function' && ret !== cb) {
|
|
||||||
Object.keys(cb).forEach(function (k) {
|
|
||||||
ret[k] = cb[k]
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return ret
|
|
||||||
}
|
|
||||||
}
|
|
2
node_modules/cordova-common/node_modules/glob/package.json
generated
vendored
2
node_modules/cordova-common/node_modules/glob/package.json
generated
vendored
@ -68,6 +68,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
|
"_resolved": "http://registry.npmjs.org/glob/-/glob-5.0.15.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
25
node_modules/cordova-common/node_modules/osenv/node_modules/os-tmpdir/package.json
generated
vendored
25
node_modules/cordova-common/node_modules/osenv/node_modules/os-tmpdir/package.json
generated
vendored
@ -40,31 +40,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "0.0.4"
|
"ava": "0.0.4"
|
||||||
},
|
},
|
||||||
"gitHead": "5c5d355f81378980db629d60128ad03e02b1c1e5",
|
"readme": "# os-tmpdir [](https://travis-ci.org/sindresorhus/os-tmpdir)\n\n> Node.js [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir) ponyfill\n\n> Ponyfill: A polyfill that doesn't overwrite the native method\n\nUse this instead of `require('os').tmpdir()` to get a consistent behaviour on different Node.js versions (even 0.8).\n\n*This is actually taken from io.js 2.0.2 as it contains some fixes that haven't bubbled up to Node.js yet.*\n\n\n## Install\n\n```\n$ npm install --save os-tmpdir\n```\n\n\n## Usage\n\n```js\nvar osTmpdir = require('os-tmpdir');\n\nosTmpdir();\n//=> /var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T\n```\n\n\n## API\n\nSee the [`os.tmpdir()` docs](https://nodejs.org/api/os.html#os_os_tmpdir).\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n",
|
||||||
|
"readmeFilename": "readme.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/sindresorhus/os-tmpdir/issues"
|
"url": "https://github.com/sindresorhus/os-tmpdir/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/sindresorhus/os-tmpdir",
|
"homepage": "https://github.com/sindresorhus/os-tmpdir#readme",
|
||||||
"_id": "os-tmpdir@1.0.1",
|
"_id": "os-tmpdir@1.0.1",
|
||||||
"_shasum": "e9b423a1edaf479882562e92ed71d7743a071b6e",
|
"_shasum": "e9b423a1edaf479882562e92ed71d7743a071b6e",
|
||||||
"_from": "os-tmpdir@>=1.0.0 <2.0.0",
|
|
||||||
"_npmVersion": "2.9.1",
|
|
||||||
"_nodeVersion": "0.12.3",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "sindresorhus",
|
|
||||||
"email": "sindresorhus@gmail.com"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"shasum": "e9b423a1edaf479882562e92ed71d7743a071b6e",
|
|
||||||
"tarball": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "sindresorhus",
|
|
||||||
"email": "sindresorhus@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directories": {},
|
|
||||||
"_resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz",
|
"_resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"_from": "os-tmpdir@>=1.0.0 <2.0.0"
|
||||||
}
|
}
|
||||||
|
23
node_modules/cordova-common/node_modules/plist/node_modules/base64-js/package.json
generated
vendored
23
node_modules/cordova-common/node_modules/plist/node_modules/base64-js/package.json
generated
vendored
@ -34,29 +34,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"tape": "~2.3.2"
|
"tape": "~2.3.2"
|
||||||
},
|
},
|
||||||
|
"readme": "base64-js\n=========\n\n`base64-js` does basic base64 encoding/decoding in pure JS.\n\n[](http://travis-ci.org/beatgammit/base64-js)\n\n[](https://ci.testling.com/beatgammit/base64-js)\n\nMany browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.\n\nSometimes encoding/decoding binary data in the browser is useful, and that is what this module does.\n\n## install\n\nWith [npm](https://npmjs.org) do:\n\n`npm install base64-js`\n\n## methods\n\n`var base64 = require('base64-js')`\n\n`base64` has two exposed functions, `toByteArray` and `fromByteArray`, which both take a single argument.\n\n* `toByteArray` - Takes a base64 string and returns a byte array\n* `fromByteArray` - Takes a byte array and returns a base64 string\n\n## license\n\nMIT",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/beatgammit/base64-js/issues"
|
"url": "https://github.com/beatgammit/base64-js/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/beatgammit/base64-js",
|
"homepage": "https://github.com/beatgammit/base64-js#readme",
|
||||||
"_id": "base64-js@0.0.6",
|
"_id": "base64-js@0.0.6",
|
||||||
"dist": {
|
|
||||||
"shasum": "7b859f79f0bbbd55867ba67a7fab397e24a20947",
|
|
||||||
"tarball": "http://registry.npmjs.org/base64-js/-/base64-js-0.0.6.tgz"
|
|
||||||
},
|
|
||||||
"_from": "base64-js@0.0.6",
|
|
||||||
"_npmVersion": "1.3.21",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "feross",
|
|
||||||
"email": "feross@feross.org"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "feross",
|
|
||||||
"email": "feross@feross.org"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directories": {},
|
|
||||||
"_shasum": "7b859f79f0bbbd55867ba67a7fab397e24a20947",
|
"_shasum": "7b859f79f0bbbd55867ba67a7fab397e24a20947",
|
||||||
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.6.tgz",
|
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.6.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"_from": "base64-js@0.0.6"
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,6 @@
|
|||||||
],
|
],
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_shasum": "3007af012c140eae26de05576ec22785cac3abf2",
|
"_shasum": "3007af012c140eae26de05576ec22785cac3abf2",
|
||||||
"_resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.0.tgz",
|
"_resolved": "http://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.0.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
@ -47,37 +47,10 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/lodash/lodash-node.git"
|
"url": "git+https://github.com/lodash/lodash-node.git"
|
||||||
},
|
},
|
||||||
|
"readme": "# lodash-node v2.4.1\n\nA collection of [Lo-Dash](http://lodash.com/) methods as [Node.js](http://nodejs.org/) modules generated by [lodash-cli](https://npmjs.org/package/lodash-cli).\n\n## Installation & usage\n\nUsing [`npm`](http://npmjs.org/):\n\n```bash\nnpm i --save lodash-node\n\n{sudo} npm i -g lodash-node\nnpm ln lodash-node\n```\n\nIn Node.js:\n\n```js\nvar _ = require('lodash-node');\n\n// or as Underscore\nvar _ = require('lodash-node/underscore');\n\n// or by method category\nvar collections = require('lodash-node/modern/collections');\n\n// or individual methods\nvar isEqual = require('lodash-node/modern/objects/isEqual');\nvar findWhere = require('lodash-node/underscore/collections/findWhere');\n```\n\n## Author\n\n| [](https://twitter.com/jdalton \"Follow @jdalton on Twitter\") |\n|---|\n| [John-David Dalton](http://allyoucanleet.com/) |\n\n## Contributors\n\n| [](https://twitter.com/blainebublitz \"Follow @BlaineBublitz on Twitter\") | [](https://twitter.com/kitcambridge \"Follow @kitcambridge on Twitter\") | [](https://twitter.com/mathias \"Follow @mathias on Twitter\") |\n|---|---|---|\n| [Blaine Bublitz](http://www.iceddev.com/) | [Kit Cambridge](http://kitcambridge.be/) | [Mathias Bynens](http://mathiasbynens.be/) |\n\n[](https://bitdeli.com/free \"Bitdeli Badge\")\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"_id": "lodash-node@2.4.1",
|
"_id": "lodash-node@2.4.1",
|
||||||
"dist": {
|
|
||||||
"shasum": "ea82f7b100c733d1a42af76801e506105e2a80ec",
|
|
||||||
"tarball": "http://registry.npmjs.org/lodash-node/-/lodash-node-2.4.1.tgz"
|
|
||||||
},
|
|
||||||
"_from": "lodash-node@>=2.4.1 <2.5.0",
|
|
||||||
"_npmVersion": "1.3.14",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "jdalton",
|
|
||||||
"email": "john.david.dalton@gmail.com"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "jdalton",
|
|
||||||
"email": "john.david.dalton@gmail.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "kitcambridge",
|
|
||||||
"email": "github@kitcambridge.be"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "mathias",
|
|
||||||
"email": "mathias@qiwi.be"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "phated",
|
|
||||||
"email": "blaine@iceddev.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directories": {},
|
|
||||||
"_shasum": "ea82f7b100c733d1a42af76801e506105e2a80ec",
|
"_shasum": "ea82f7b100c733d1a42af76801e506105e2a80ec",
|
||||||
"_resolved": "https://registry.npmjs.org/lodash-node/-/lodash-node-2.4.1.tgz",
|
"_resolved": "https://registry.npmjs.org/lodash-node/-/lodash-node-2.4.1.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"_from": "lodash-node@>=2.4.1 <2.5.0"
|
||||||
}
|
}
|
||||||
|
2
node_modules/cordova-common/node_modules/plist/node_modules/xmlbuilder/package.json
generated
vendored
2
node_modules/cordova-common/node_modules/plist/node_modules/xmlbuilder/package.json
generated
vendored
@ -60,6 +60,6 @@
|
|||||||
],
|
],
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_shasum": "9326430f130d87435d4c4086643aa2926e105a32",
|
"_shasum": "9326430f130d87435d4c4086643aa2926e105a32",
|
||||||
"_resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-2.2.1.tgz",
|
"_resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-2.2.1.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
30
node_modules/cordova-common/node_modules/plist/node_modules/xmldom/package.json
generated
vendored
30
node_modules/cordova-common/node_modules/plist/node_modules/xmldom/package.json
generated
vendored
File diff suppressed because one or more lines are too long
32
node_modules/cordova-common/node_modules/plist/package.json
generated
vendored
32
node_modules/cordova-common/node_modules/plist/package.json
generated
vendored
@ -53,38 +53,14 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "make test"
|
"test": "make test"
|
||||||
},
|
},
|
||||||
"gitHead": "806c35e79ad1326da22ced98bc9c721ff570af84",
|
"readme": "plist.js\n========\n### Mac OS X Plist parser/builder for Node.js and browsers\n\n[](https://saucelabs.com/u/plistjs)\n\n[](https://travis-ci.org/TooTallNate/plist.js)\n\nProvides facilities for reading and writing Mac OS X Plist (property list)\nfiles. These are often used in programming OS X and iOS applications, as\nwell as the iTunes configuration XML file.\n\nPlist files represent stored programming \"object\"s. They are very similar\nto JSON. A valid Plist file is representable as a native JavaScript Object\nand vice-versa.\n\n\n## Usage\n\n### Node.js\n\nInstall using `npm`:\n\n``` bash\n$ npm install --save plist\n```\n\nThen `require()` the _plist_ module in your file:\n\n``` js\nvar plist = require('plist');\n\n// now use the `parse()` and `build()` functions\nvar val = plist.parse('<plist><string>Hello World!</string></plist>');\nconsole.log(val); // \"Hello World!\"\n```\n\n\n### Browser\n\nInclude the `dist/plist.js` in a `<script>` tag in your HTML file:\n\n``` html\n<script src=\"plist.js\"></script>\n<script>\n // now use the `parse()` and `build()` functions\n var val = plist.parse('<plist><string>Hello World!</string></plist>');\n console.log(val); // \"Hello World!\"\n</script>\n```\n\n\n## API\n\n### Parsing\n\nParsing a plist from filename:\n\n``` javascript\nvar fs = require('fs');\nvar plist = require('plist');\n\nvar obj = plist.parse(fs.readFileSync('myPlist.plist', 'utf8'));\nconsole.log(JSON.stringify(obj));\n```\n\nParsing a plist from string payload:\n\n``` javascript\nvar plist = require('plist');\n\nvar obj = plist.parse('<plist><string>Hello World!</string></plist>');\nconsole.log(obj); // Hello World!\n```\n\n### Building\n\nGiven an existing JavaScript Object, you can turn it into an XML document\nthat complies with the plist DTD:\n\n``` javascript\nvar plist = require('plist');\n\nconsole.log(plist.build({ foo: 'bar' }));\n```\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2010-2014 Nathan Rajlich <nathan@tootallnate.net>\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/TooTallNate/node-plist/issues"
|
"url": "https://github.com/TooTallNate/node-plist/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/TooTallNate/node-plist",
|
"homepage": "https://github.com/TooTallNate/node-plist#readme",
|
||||||
"_id": "plist@1.1.0",
|
"_id": "plist@1.1.0",
|
||||||
"_shasum": "ff6708590c97cc438e7bc45de5251bd725f3f89d",
|
"_shasum": "ff6708590c97cc438e7bc45de5251bd725f3f89d",
|
||||||
"_from": "plist@>=1.1.0 <2.0.0",
|
|
||||||
"_npmVersion": "1.4.21",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "tootallnate",
|
|
||||||
"email": "nathan@tootallnate.net"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "TooTallNate",
|
|
||||||
"email": "nathan@tootallnate.net"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "tootallnate",
|
|
||||||
"email": "nathan@tootallnate.net"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "mreinstein",
|
|
||||||
"email": "reinstein.mike@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dist": {
|
|
||||||
"shasum": "ff6708590c97cc438e7bc45de5251bd725f3f89d",
|
|
||||||
"tarball": "http://registry.npmjs.org/plist/-/plist-1.1.0.tgz"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"_resolved": "https://registry.npmjs.org/plist/-/plist-1.1.0.tgz",
|
"_resolved": "https://registry.npmjs.org/plist/-/plist-1.1.0.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"_from": "plist@>=1.1.0 <2.0.0"
|
||||||
}
|
}
|
||||||
|
2
node_modules/cordova-common/node_modules/semver/package.json
generated
vendored
2
node_modules/cordova-common/node_modules/semver/package.json
generated
vendored
@ -46,6 +46,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz",
|
"_resolved": "http://registry.npmjs.org/semver/-/semver-5.0.3.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
22
node_modules/cordova-common/node_modules/underscore/package.json
generated
vendored
22
node_modules/cordova-common/node_modules/underscore/package.json
generated
vendored
@ -42,29 +42,13 @@
|
|||||||
"underscore-min.map",
|
"underscore-min.map",
|
||||||
"LICENSE"
|
"LICENSE"
|
||||||
],
|
],
|
||||||
"gitHead": "e4743ab712b8ab42ad4ccb48b155034d02394e4d",
|
"readme": " __\n /\\ \\ __\n __ __ ___ \\_\\ \\ __ _ __ ____ ___ ___ _ __ __ /\\_\\ ____\n /\\ \\/\\ \\ /' _ `\\ /'_ \\ /'__`\\/\\ __\\/ ,__\\ / ___\\ / __`\\/\\ __\\/'__`\\ \\/\\ \\ /',__\\\n \\ \\ \\_\\ \\/\\ \\/\\ \\/\\ \\ \\ \\/\\ __/\\ \\ \\//\\__, `\\/\\ \\__//\\ \\ \\ \\ \\ \\//\\ __/ __ \\ \\ \\/\\__, `\\\n \\ \\____/\\ \\_\\ \\_\\ \\___,_\\ \\____\\\\ \\_\\\\/\\____/\\ \\____\\ \\____/\\ \\_\\\\ \\____\\/\\_\\ _\\ \\ \\/\\____/\n \\/___/ \\/_/\\/_/\\/__,_ /\\/____/ \\/_/ \\/___/ \\/____/\\/___/ \\/_/ \\/____/\\/_//\\ \\_\\ \\/___/\n \\ \\____/\n \\/___/\n\nUnderscore.js is a utility-belt library for JavaScript that provides\nsupport for the usual functional suspects (each, map, reduce, filter...)\nwithout extending any core JavaScript objects.\n\nFor Docs, License, Tests, and pre-packed downloads, see:\nhttp://underscorejs.org\n\nUnderscore is an open-sourced component of DocumentCloud:\nhttps://github.com/documentcloud\n\nMany thanks to our contributors:\nhttps://github.com/jashkenas/underscore/contributors\n",
|
||||||
|
"readmeFilename": "README.md",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/jashkenas/underscore/issues"
|
"url": "https://github.com/jashkenas/underscore/issues"
|
||||||
},
|
},
|
||||||
"_id": "underscore@1.8.3",
|
"_id": "underscore@1.8.3",
|
||||||
"_shasum": "4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022",
|
"_shasum": "4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022",
|
||||||
"_from": "underscore@>=1.8.3 <2.0.0",
|
|
||||||
"_npmVersion": "1.4.28",
|
|
||||||
"_npmUser": {
|
|
||||||
"name": "jashkenas",
|
|
||||||
"email": "jashkenas@gmail.com"
|
|
||||||
},
|
|
||||||
"maintainers": [
|
|
||||||
{
|
|
||||||
"name": "jashkenas",
|
|
||||||
"email": "jashkenas@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dist": {
|
|
||||||
"shasum": "4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022",
|
|
||||||
"tarball": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz"
|
|
||||||
},
|
|
||||||
"directories": {},
|
|
||||||
"_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
|
"_resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"_from": "underscore@>=1.8.3 <2.0.0"
|
||||||
}
|
}
|
||||||
|
2
node_modules/cordova-common/node_modules/unorm/package.json
generated
vendored
2
node_modules/cordova-common/node_modules/unorm/package.json
generated
vendored
@ -64,6 +64,6 @@
|
|||||||
"tarball": "http://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz"
|
"tarball": "http://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz"
|
||||||
},
|
},
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_resolved": "https://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz",
|
"_resolved": "http://registry.npmjs.org/unorm/-/unorm-1.4.1.tgz",
|
||||||
"readme": "ERROR: No README data found!"
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
50
node_modules/cordova-common/package.json
generated
vendored
50
node_modules/cordova-common/package.json
generated
vendored
@ -5,7 +5,7 @@
|
|||||||
"name": "cordova-common",
|
"name": "cordova-common",
|
||||||
"description": "Apache Cordova tools and platforms shared routines",
|
"description": "Apache Cordova tools and platforms shared routines",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"version": "0.1.0",
|
"version": "1.0.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://git-wip-us.apache.org/repos/asf/cordova-common.git"
|
"url": "git://git-wip-us.apache.org/repos/asf/cordova-common.git"
|
||||||
@ -44,10 +44,46 @@
|
|||||||
"jshint": "^2.8.0"
|
"jshint": "^2.8.0"
|
||||||
},
|
},
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
"readme": "<!--\r\n#\r\n# Licensed to the Apache Software Foundation (ASF) under one\r\n# or more contributor license agreements. See the NOTICE file\r\n# distributed with this work for additional information\r\n# regarding copyright ownership. The ASF licenses this file\r\n# to you under the Apache License, Version 2.0 (the\r\n# \"License\"); you may not use this file except in compliance\r\n# with the License. You may obtain a copy of the License at\r\n#\r\n# http://www.apache.org/licenses/LICENSE-2.0\r\n#\r\n# Unless required by applicable law or agreed to in writing,\r\n# software distributed under the License is distributed on an\r\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n# KIND, either express or implied. See the License for the\r\n# specific language governing permissions and limitations\r\n# under the License.\r\n#\r\n-->\r\n\r\n# cordova-common\r\nContains shared classes and routines used by [cordova-lib](https://github.com/apache/cordova-lib/) and platforms.\r\n\r\n## Setup\r\n* Clone this repository onto your local machine. \r\n `git clone https://git-wip-us.apache.org/repos/asf/cordova-lib.git`\r\n* In terminal, navigate to the inner cordova-common directory.\r\n `cd cordova-lib/cordova-common`\r\n* Install dependencies and npm-link\r\n `npm install && npm link`\r\n* Navigate to cordova-lib directory and link cordova-common\r\n `cd ../cordova-lib && npm link cordova-common && npm install`\r\n",
|
"_id": "cordova-common@1.0.0",
|
||||||
"readmeFilename": "README.md",
|
"_shasum": "b21947e89a4a89292ec563abf9ee6ccb2b9f3aef",
|
||||||
"_id": "cordova-common@0.1.0",
|
"_resolved": "http://registry.npmjs.org/cordova-common/-/cordova-common-1.0.0.tgz",
|
||||||
"_shasum": "3555577965cd29e116690f551ea1b7dd61019a0b",
|
"_from": "cordova-common@>=1.0.0 <1.1.0",
|
||||||
"_from": "..\\cordova-lib\\cordova-common",
|
"_npmVersion": "2.14.7",
|
||||||
"_resolved": "file:..\\cordova-lib\\cordova-common"
|
"_nodeVersion": "4.2.1",
|
||||||
|
"_npmUser": {
|
||||||
|
"name": "kotikov.vladimir",
|
||||||
|
"email": "kotikov.vladimir@gmail.com"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"shasum": "b21947e89a4a89292ec563abf9ee6ccb2b9f3aef",
|
||||||
|
"tarball": "http://registry.npmjs.org/cordova-common/-/cordova-common-1.0.0.tgz"
|
||||||
|
},
|
||||||
|
"maintainers": [
|
||||||
|
{
|
||||||
|
"name": "bowserj",
|
||||||
|
"email": "bowserj@apache.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "kotikov.vladimir",
|
||||||
|
"email": "kotikov.vladimir@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "purplecabbage",
|
||||||
|
"email": "purplecabbage@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "shazron",
|
||||||
|
"email": "shazron@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stevegill",
|
||||||
|
"email": "stevengill97@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "timbarham",
|
||||||
|
"email": "npmjs@barhams.info"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directories": {},
|
||||||
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
20
node_modules/cordova-common/src/.jshintrc
generated
vendored
20
node_modules/cordova-common/src/.jshintrc
generated
vendored
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"node": true
|
"node": true
|
||||||
, "bitwise": true
|
, "bitwise": true
|
||||||
, "undef": true
|
, "undef": true
|
||||||
, "trailing": true
|
, "trailing": true
|
||||||
, "quotmark": true
|
, "quotmark": true
|
||||||
, "indent": 4
|
, "indent": 4
|
||||||
, "unused": "vars"
|
, "unused": "vars"
|
||||||
, "latedef": "nofunc"
|
, "latedef": "nofunc"
|
||||||
}
|
}
|
||||||
|
170
node_modules/cordova-common/src/ActionStack.js
generated
vendored
170
node_modules/cordova-common/src/ActionStack.js
generated
vendored
@ -1,85 +1,85 @@
|
|||||||
/**
|
/**
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint quotmark:false */
|
/* jshint quotmark:false */
|
||||||
|
|
||||||
var events = require('./events'),
|
var events = require('./events'),
|
||||||
Q = require('q');
|
Q = require('q');
|
||||||
|
|
||||||
function ActionStack() {
|
function ActionStack() {
|
||||||
this.stack = [];
|
this.stack = [];
|
||||||
this.completed = [];
|
this.completed = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionStack.prototype = {
|
ActionStack.prototype = {
|
||||||
createAction:function(handler, action_params, reverter, revert_params) {
|
createAction:function(handler, action_params, reverter, revert_params) {
|
||||||
return {
|
return {
|
||||||
handler:{
|
handler:{
|
||||||
run:handler,
|
run:handler,
|
||||||
params:action_params
|
params:action_params
|
||||||
},
|
},
|
||||||
reverter:{
|
reverter:{
|
||||||
run:reverter,
|
run:reverter,
|
||||||
params:revert_params
|
params:revert_params
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
push:function(tx) {
|
push:function(tx) {
|
||||||
this.stack.push(tx);
|
this.stack.push(tx);
|
||||||
},
|
},
|
||||||
// Returns a promise.
|
// Returns a promise.
|
||||||
process:function(platform) {
|
process:function(platform) {
|
||||||
events.emit('verbose', 'Beginning processing of action stack for ' + platform + ' project...');
|
events.emit('verbose', 'Beginning processing of action stack for ' + platform + ' project...');
|
||||||
|
|
||||||
while (this.stack.length) {
|
while (this.stack.length) {
|
||||||
var action = this.stack.shift();
|
var action = this.stack.shift();
|
||||||
var handler = action.handler.run;
|
var handler = action.handler.run;
|
||||||
var action_params = action.handler.params;
|
var action_params = action.handler.params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
handler.apply(null, action_params);
|
handler.apply(null, action_params);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
events.emit('warn', 'Error during processing of action! Attempting to revert...');
|
events.emit('warn', 'Error during processing of action! Attempting to revert...');
|
||||||
this.stack.unshift(action);
|
this.stack.unshift(action);
|
||||||
var issue = 'Uh oh!\n';
|
var issue = 'Uh oh!\n';
|
||||||
// revert completed tasks
|
// revert completed tasks
|
||||||
while(this.completed.length) {
|
while(this.completed.length) {
|
||||||
var undo = this.completed.shift();
|
var undo = this.completed.shift();
|
||||||
var revert = undo.reverter.run;
|
var revert = undo.reverter.run;
|
||||||
var revert_params = undo.reverter.params;
|
var revert_params = undo.reverter.params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
revert.apply(null, revert_params);
|
revert.apply(null, revert_params);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
events.emit('warn', 'Error during reversion of action! We probably really messed up your project now, sorry! D:');
|
events.emit('warn', 'Error during reversion of action! We probably really messed up your project now, sorry! D:');
|
||||||
issue += 'A reversion action failed: ' + err.message + '\n';
|
issue += 'A reversion action failed: ' + err.message + '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e.message = issue + e.message;
|
e.message = issue + e.message;
|
||||||
return Q.reject(e);
|
return Q.reject(e);
|
||||||
}
|
}
|
||||||
this.completed.push(action);
|
this.completed.push(action);
|
||||||
}
|
}
|
||||||
events.emit('verbose', 'Action stack processing complete.');
|
events.emit('verbose', 'Action stack processing complete.');
|
||||||
|
|
||||||
return Q();
|
return Q();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ActionStack;
|
module.exports = ActionStack;
|
||||||
|
650
node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
generated
vendored
650
node_modules/cordova-common/src/ConfigChanges/ConfigChanges.js
generated
vendored
@ -1,325 +1,325 @@
|
|||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2013 Anis Kadri
|
* Copyright 2013 Anis Kadri
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This module deals with shared configuration / dependency "stuff". That is:
|
* This module deals with shared configuration / dependency "stuff". That is:
|
||||||
* - XML configuration files such as config.xml, AndroidManifest.xml or WMAppManifest.xml.
|
* - XML configuration files such as config.xml, AndroidManifest.xml or WMAppManifest.xml.
|
||||||
* - plist files in iOS
|
* - plist files in iOS
|
||||||
* Essentially, any type of shared resources that we need to handle with awareness
|
* Essentially, any type of shared resources that we need to handle with awareness
|
||||||
* of how potentially multiple plugins depend on a single shared resource, should be
|
* of how potentially multiple plugins depend on a single shared resource, should be
|
||||||
* handled in this module.
|
* handled in this module.
|
||||||
*
|
*
|
||||||
* The implementation uses an object as a hash table, with "leaves" of the table tracking
|
* The implementation uses an object as a hash table, with "leaves" of the table tracking
|
||||||
* reference counts.
|
* reference counts.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint sub:true */
|
/* jshint sub:true */
|
||||||
|
|
||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
et = require('elementtree'),
|
et = require('elementtree'),
|
||||||
semver = require('semver'),
|
semver = require('semver'),
|
||||||
events = require('../events'),
|
events = require('../events'),
|
||||||
ConfigKeeper = require('./ConfigKeeper');
|
ConfigKeeper = require('./ConfigKeeper');
|
||||||
|
|
||||||
var mungeutil = require('./munge-util');
|
var mungeutil = require('./munge-util');
|
||||||
|
|
||||||
exports.PlatformMunger = PlatformMunger;
|
exports.PlatformMunger = PlatformMunger;
|
||||||
|
|
||||||
exports.process = function(plugins_dir, project_dir, platform, platformJson, pluginInfoProvider) {
|
exports.process = function(plugins_dir, project_dir, platform, platformJson, pluginInfoProvider) {
|
||||||
var munger = new PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider);
|
var munger = new PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider);
|
||||||
munger.process(plugins_dir);
|
munger.process(plugins_dir);
|
||||||
munger.save_all();
|
munger.save_all();
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* PlatformMunger class
|
* PlatformMunger class
|
||||||
*
|
*
|
||||||
* Can deal with config file of a single project.
|
* Can deal with config file of a single project.
|
||||||
* Parsed config files are cached in a ConfigKeeper object.
|
* Parsed config files are cached in a ConfigKeeper object.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
|
function PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider) {
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.project_dir = project_dir;
|
this.project_dir = project_dir;
|
||||||
this.config_keeper = new ConfigKeeper(project_dir);
|
this.config_keeper = new ConfigKeeper(project_dir);
|
||||||
this.platformJson = platformJson;
|
this.platformJson = platformJson;
|
||||||
this.pluginInfoProvider = pluginInfoProvider;
|
this.pluginInfoProvider = pluginInfoProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out all unsaved files.
|
// Write out all unsaved files.
|
||||||
PlatformMunger.prototype.save_all = PlatformMunger_save_all;
|
PlatformMunger.prototype.save_all = PlatformMunger_save_all;
|
||||||
function PlatformMunger_save_all() {
|
function PlatformMunger_save_all() {
|
||||||
this.config_keeper.save_all();
|
this.config_keeper.save_all();
|
||||||
this.platformJson.save();
|
this.platformJson.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply a munge object to a single config file.
|
// Apply a munge object to a single config file.
|
||||||
// The remove parameter tells whether to add the change or remove it.
|
// The remove parameter tells whether to add the change or remove it.
|
||||||
PlatformMunger.prototype.apply_file_munge = PlatformMunger_apply_file_munge;
|
PlatformMunger.prototype.apply_file_munge = PlatformMunger_apply_file_munge;
|
||||||
function PlatformMunger_apply_file_munge(file, munge, remove) {
|
function PlatformMunger_apply_file_munge(file, munge, remove) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
for (var selector in munge.parents) {
|
for (var selector in munge.parents) {
|
||||||
for (var xml_child in munge.parents[selector]) {
|
for (var xml_child in munge.parents[selector]) {
|
||||||
// this xml child is new, graft it (only if config file exists)
|
// this xml child is new, graft it (only if config file exists)
|
||||||
var config_file = self.config_keeper.get(self.project_dir, self.platform, file);
|
var config_file = self.config_keeper.get(self.project_dir, self.platform, file);
|
||||||
if (config_file.exists) {
|
if (config_file.exists) {
|
||||||
if (remove) config_file.prune_child(selector, munge.parents[selector][xml_child]);
|
if (remove) config_file.prune_child(selector, munge.parents[selector][xml_child]);
|
||||||
else config_file.graft_child(selector, munge.parents[selector][xml_child]);
|
else config_file.graft_child(selector, munge.parents[selector][xml_child]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PlatformMunger.prototype.remove_plugin_changes = remove_plugin_changes;
|
PlatformMunger.prototype.remove_plugin_changes = remove_plugin_changes;
|
||||||
function remove_plugin_changes(pluginInfo, is_top_level) {
|
function remove_plugin_changes(pluginInfo, is_top_level) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var platform_config = self.platformJson.root;
|
var platform_config = self.platformJson.root;
|
||||||
var plugin_vars = is_top_level ?
|
var plugin_vars = is_top_level ?
|
||||||
platform_config.installed_plugins[pluginInfo.id] :
|
platform_config.installed_plugins[pluginInfo.id] :
|
||||||
platform_config.dependent_plugins[pluginInfo.id];
|
platform_config.dependent_plugins[pluginInfo.id];
|
||||||
|
|
||||||
// get config munge, aka how did this plugin change various config files
|
// get config munge, aka how did this plugin change various config files
|
||||||
var config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars);
|
var config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars);
|
||||||
// global munge looks at all plugins' changes to config files
|
// global munge looks at all plugins' changes to config files
|
||||||
var global_munge = platform_config.config_munge;
|
var global_munge = platform_config.config_munge;
|
||||||
var munge = mungeutil.decrement_munge(global_munge, config_munge);
|
var munge = mungeutil.decrement_munge(global_munge, config_munge);
|
||||||
|
|
||||||
for (var file in munge.files) {
|
for (var file in munge.files) {
|
||||||
// CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
|
// CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
|
||||||
if (self.platform == 'windows' && file == 'package.appxmanifest' &&
|
if (self.platform == 'windows' && file == 'package.appxmanifest' &&
|
||||||
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
|
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
|
||||||
// New windows template separate manifest files for Windows8, Windows8.1 and WP8.1
|
// New windows template separate manifest files for Windows8, Windows8.1 and WP8.1
|
||||||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows80.appxmanifest', 'package.windows10.appxmanifest'];
|
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows80.appxmanifest', 'package.windows10.appxmanifest'];
|
||||||
/* jshint loopfunc:true */
|
/* jshint loopfunc:true */
|
||||||
substs.forEach(function(subst) {
|
substs.forEach(function(subst) {
|
||||||
events.emit('verbose', 'Applying munge to ' + subst);
|
events.emit('verbose', 'Applying munge to ' + subst);
|
||||||
self.apply_file_munge(subst, munge.files[file], true);
|
self.apply_file_munge(subst, munge.files[file], true);
|
||||||
});
|
});
|
||||||
/* jshint loopfunc:false */
|
/* jshint loopfunc:false */
|
||||||
}
|
}
|
||||||
self.apply_file_munge(file, munge.files[file], /* remove = */ true);
|
self.apply_file_munge(file, munge.files[file], /* remove = */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove from installed_plugins
|
// Remove from installed_plugins
|
||||||
self.platformJson.removePlugin(pluginInfo.id, is_top_level);
|
self.platformJson.removePlugin(pluginInfo.id, is_top_level);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PlatformMunger.prototype.add_plugin_changes = add_plugin_changes;
|
PlatformMunger.prototype.add_plugin_changes = add_plugin_changes;
|
||||||
function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increment) {
|
function add_plugin_changes(pluginInfo, plugin_vars, is_top_level, should_increment) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var platform_config = self.platformJson.root;
|
var platform_config = self.platformJson.root;
|
||||||
|
|
||||||
// get config munge, aka how should this plugin change various config files
|
// get config munge, aka how should this plugin change various config files
|
||||||
var config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars);
|
var config_munge = self.generate_plugin_config_munge(pluginInfo, plugin_vars);
|
||||||
// global munge looks at all plugins' changes to config files
|
// global munge looks at all plugins' changes to config files
|
||||||
|
|
||||||
// TODO: The should_increment param is only used by cordova-cli and is going away soon.
|
// TODO: The should_increment param is only used by cordova-cli and is going away soon.
|
||||||
// If should_increment is set to false, avoid modifying the global_munge (use clone)
|
// If should_increment is set to false, avoid modifying the global_munge (use clone)
|
||||||
// and apply the entire config_munge because it's already a proper subset of the global_munge.
|
// and apply the entire config_munge because it's already a proper subset of the global_munge.
|
||||||
var munge, global_munge;
|
var munge, global_munge;
|
||||||
if (should_increment) {
|
if (should_increment) {
|
||||||
global_munge = platform_config.config_munge;
|
global_munge = platform_config.config_munge;
|
||||||
munge = mungeutil.increment_munge(global_munge, config_munge);
|
munge = mungeutil.increment_munge(global_munge, config_munge);
|
||||||
} else {
|
} else {
|
||||||
global_munge = mungeutil.clone_munge(platform_config.config_munge);
|
global_munge = mungeutil.clone_munge(platform_config.config_munge);
|
||||||
munge = config_munge;
|
munge = config_munge;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var file in munge.files) {
|
for (var file in munge.files) {
|
||||||
// CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
|
// CB-6976 Windows Universal Apps. Compatibility fix for existing plugins.
|
||||||
if (self.platform == 'windows' && file == 'package.appxmanifest' &&
|
if (self.platform == 'windows' && file == 'package.appxmanifest' &&
|
||||||
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
|
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) {
|
||||||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows80.appxmanifest', 'package.windows10.appxmanifest'];
|
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows80.appxmanifest', 'package.windows10.appxmanifest'];
|
||||||
/* jshint loopfunc:true */
|
/* jshint loopfunc:true */
|
||||||
substs.forEach(function(subst) {
|
substs.forEach(function(subst) {
|
||||||
events.emit('verbose', 'Applying munge to ' + subst);
|
events.emit('verbose', 'Applying munge to ' + subst);
|
||||||
self.apply_file_munge(subst, munge.files[file]);
|
self.apply_file_munge(subst, munge.files[file]);
|
||||||
});
|
});
|
||||||
/* jshint loopfunc:false */
|
/* jshint loopfunc:false */
|
||||||
}
|
}
|
||||||
self.apply_file_munge(file, munge.files[file]);
|
self.apply_file_munge(file, munge.files[file]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move to installed/dependent_plugins
|
// Move to installed/dependent_plugins
|
||||||
self.platformJson.addPlugin(pluginInfo.id, plugin_vars || {}, is_top_level);
|
self.platformJson.addPlugin(pluginInfo.id, plugin_vars || {}, is_top_level);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Load the global munge from platform json and apply all of it.
|
// Load the global munge from platform json and apply all of it.
|
||||||
// Used by cordova prepare to re-generate some config file from platform
|
// Used by cordova prepare to re-generate some config file from platform
|
||||||
// defaults and the global munge.
|
// defaults and the global munge.
|
||||||
PlatformMunger.prototype.reapply_global_munge = reapply_global_munge ;
|
PlatformMunger.prototype.reapply_global_munge = reapply_global_munge ;
|
||||||
function reapply_global_munge () {
|
function reapply_global_munge () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var platform_config = self.platformJson.root;
|
var platform_config = self.platformJson.root;
|
||||||
var global_munge = platform_config.config_munge;
|
var global_munge = platform_config.config_munge;
|
||||||
for (var file in global_munge.files) {
|
for (var file in global_munge.files) {
|
||||||
self.apply_file_munge(file, global_munge.files[file]);
|
self.apply_file_munge(file, global_munge.files[file]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// generate_plugin_config_munge
|
// generate_plugin_config_munge
|
||||||
// Generate the munge object from plugin.xml + vars
|
// Generate the munge object from plugin.xml + vars
|
||||||
PlatformMunger.prototype.generate_plugin_config_munge = generate_plugin_config_munge;
|
PlatformMunger.prototype.generate_plugin_config_munge = generate_plugin_config_munge;
|
||||||
function generate_plugin_config_munge(pluginInfo, vars) {
|
function generate_plugin_config_munge(pluginInfo, vars) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
vars = vars || {};
|
vars = vars || {};
|
||||||
var munge = { files: {} };
|
var munge = { files: {} };
|
||||||
var changes = pluginInfo.getConfigFiles(self.platform);
|
var changes = pluginInfo.getConfigFiles(self.platform);
|
||||||
|
|
||||||
// Demux 'package.appxmanifest' into relevant platform-specific appx manifests.
|
// Demux 'package.appxmanifest' into relevant platform-specific appx manifests.
|
||||||
// Only spend the cycles if there are version-specific plugin settings
|
// Only spend the cycles if there are version-specific plugin settings
|
||||||
if (self.platform === 'windows' &&
|
if (self.platform === 'windows' &&
|
||||||
changes.some(function(change) {
|
changes.some(function(change) {
|
||||||
return ((typeof change.versions !== 'undefined') ||
|
return ((typeof change.versions !== 'undefined') ||
|
||||||
(typeof change.deviceTarget !== 'undefined'));
|
(typeof change.deviceTarget !== 'undefined'));
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
var manifests = {
|
var manifests = {
|
||||||
'windows': {
|
'windows': {
|
||||||
'8.0.0': 'package.windows80.appxmanifest',
|
'8.0.0': 'package.windows80.appxmanifest',
|
||||||
'8.1.0': 'package.windows.appxmanifest',
|
'8.1.0': 'package.windows.appxmanifest',
|
||||||
'10.0.0': 'package.windows10.appxmanifest'
|
'10.0.0': 'package.windows10.appxmanifest'
|
||||||
},
|
},
|
||||||
'phone': {
|
'phone': {
|
||||||
'8.1.0': 'package.phone.appxmanifest',
|
'8.1.0': 'package.phone.appxmanifest',
|
||||||
'10.0.0': 'package.windows10.appxmanifest'
|
'10.0.0': 'package.windows10.appxmanifest'
|
||||||
},
|
},
|
||||||
'all': {
|
'all': {
|
||||||
'8.0.0': 'package.windows80.appxmanifest',
|
'8.0.0': 'package.windows80.appxmanifest',
|
||||||
'8.1.0': ['package.windows.appxmanifest', 'package.phone.appxmanifest'],
|
'8.1.0': ['package.windows.appxmanifest', 'package.phone.appxmanifest'],
|
||||||
'10.0.0': 'package.windows10.appxmanifest'
|
'10.0.0': 'package.windows10.appxmanifest'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var oldChanges = changes;
|
var oldChanges = changes;
|
||||||
changes = [];
|
changes = [];
|
||||||
|
|
||||||
oldChanges.forEach(function(change, changeIndex) {
|
oldChanges.forEach(function(change, changeIndex) {
|
||||||
// Only support semver/device-target demux for package.appxmanifest
|
// Only support semver/device-target demux for package.appxmanifest
|
||||||
// Pass through in case something downstream wants to use it
|
// Pass through in case something downstream wants to use it
|
||||||
if (change.target !== 'package.appxmanifest') {
|
if (change.target !== 'package.appxmanifest') {
|
||||||
changes.push(change);
|
changes.push(change);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasVersion = (typeof change.versions !== 'undefined');
|
var hasVersion = (typeof change.versions !== 'undefined');
|
||||||
var hasTargets = (typeof change.deviceTarget !== 'undefined');
|
var hasTargets = (typeof change.deviceTarget !== 'undefined');
|
||||||
|
|
||||||
// No semver/device-target for this config-file, pass it through
|
// No semver/device-target for this config-file, pass it through
|
||||||
if (!(hasVersion || hasTargets)) {
|
if (!(hasVersion || hasTargets)) {
|
||||||
changes.push(change);
|
changes.push(change);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var targetDeviceSet = hasTargets ? change.deviceTarget : 'all';
|
var targetDeviceSet = hasTargets ? change.deviceTarget : 'all';
|
||||||
if (['windows', 'phone', 'all'].indexOf(targetDeviceSet) === -1) {
|
if (['windows', 'phone', 'all'].indexOf(targetDeviceSet) === -1) {
|
||||||
// target-device couldn't be resolved, fix it up here to a valid value
|
// target-device couldn't be resolved, fix it up here to a valid value
|
||||||
targetDeviceSet = 'all';
|
targetDeviceSet = 'all';
|
||||||
}
|
}
|
||||||
var knownWindowsVersionsForTargetDeviceSet = Object.keys(manifests[targetDeviceSet]);
|
var knownWindowsVersionsForTargetDeviceSet = Object.keys(manifests[targetDeviceSet]);
|
||||||
|
|
||||||
// at this point, 'change' targets package.appxmanifest and has a version attribute
|
// at this point, 'change' targets package.appxmanifest and has a version attribute
|
||||||
knownWindowsVersionsForTargetDeviceSet.forEach(function(winver) {
|
knownWindowsVersionsForTargetDeviceSet.forEach(function(winver) {
|
||||||
// This is a local function that creates the new replacement representing the
|
// This is a local function that creates the new replacement representing the
|
||||||
// mutation. Used to save code further down.
|
// mutation. Used to save code further down.
|
||||||
var createReplacement = function(manifestFile, originalChange) {
|
var createReplacement = function(manifestFile, originalChange) {
|
||||||
var replacement = {
|
var replacement = {
|
||||||
target: manifestFile,
|
target: manifestFile,
|
||||||
parent: originalChange.parent,
|
parent: originalChange.parent,
|
||||||
after: originalChange.after,
|
after: originalChange.after,
|
||||||
xmls: originalChange.xmls,
|
xmls: originalChange.xmls,
|
||||||
versions: originalChange.versions,
|
versions: originalChange.versions,
|
||||||
deviceTarget: originalChange.deviceTarget
|
deviceTarget: originalChange.deviceTarget
|
||||||
};
|
};
|
||||||
return replacement;
|
return replacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
// version doesn't satisfy, so skip
|
// version doesn't satisfy, so skip
|
||||||
if (hasVersion && !semver.satisfies(winver, change.versions)) {
|
if (hasVersion && !semver.satisfies(winver, change.versions)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var versionSpecificManifests = manifests[targetDeviceSet][winver];
|
var versionSpecificManifests = manifests[targetDeviceSet][winver];
|
||||||
if (versionSpecificManifests.constructor === Array) {
|
if (versionSpecificManifests.constructor === Array) {
|
||||||
// e.g. all['8.1.0'] === ['pkg.windows.appxmanifest', 'pkg.phone.appxmanifest']
|
// e.g. all['8.1.0'] === ['pkg.windows.appxmanifest', 'pkg.phone.appxmanifest']
|
||||||
versionSpecificManifests.forEach(function(manifestFile) {
|
versionSpecificManifests.forEach(function(manifestFile) {
|
||||||
changes.push(createReplacement(manifestFile, change));
|
changes.push(createReplacement(manifestFile, change));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// versionSpecificManifests is actually a single string
|
// versionSpecificManifests is actually a single string
|
||||||
changes.push(createReplacement(versionSpecificManifests, change));
|
changes.push(createReplacement(versionSpecificManifests, change));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
changes.forEach(function(change) {
|
changes.forEach(function(change) {
|
||||||
change.xmls.forEach(function(xml) {
|
change.xmls.forEach(function(xml) {
|
||||||
// 1. stringify each xml
|
// 1. stringify each xml
|
||||||
var stringified = (new et.ElementTree(xml)).write({xml_declaration:false});
|
var stringified = (new et.ElementTree(xml)).write({xml_declaration:false});
|
||||||
// interp vars
|
// interp vars
|
||||||
if (vars) {
|
if (vars) {
|
||||||
Object.keys(vars).forEach(function(key) {
|
Object.keys(vars).forEach(function(key) {
|
||||||
var regExp = new RegExp('\\$' + key, 'g');
|
var regExp = new RegExp('\\$' + key, 'g');
|
||||||
stringified = stringified.replace(regExp, vars[key]);
|
stringified = stringified.replace(regExp, vars[key]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// 2. add into munge
|
// 2. add into munge
|
||||||
mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after });
|
mungeutil.deep_add(munge, change.target, change.parent, { xml: stringified, count: 1, after: change.after });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return munge;
|
return munge;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go over the prepare queue and apply the config munges for each plugin
|
// Go over the prepare queue and apply the config munges for each plugin
|
||||||
// that has been (un)installed.
|
// that has been (un)installed.
|
||||||
PlatformMunger.prototype.process = PlatformMunger_process;
|
PlatformMunger.prototype.process = PlatformMunger_process;
|
||||||
function PlatformMunger_process(plugins_dir) {
|
function PlatformMunger_process(plugins_dir) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var platform_config = self.platformJson.root;
|
var platform_config = self.platformJson.root;
|
||||||
|
|
||||||
// Uninstallation first
|
// Uninstallation first
|
||||||
platform_config.prepare_queue.uninstalled.forEach(function(u) {
|
platform_config.prepare_queue.uninstalled.forEach(function(u) {
|
||||||
var pluginInfo = self.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
|
var pluginInfo = self.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
|
||||||
self.remove_plugin_changes(pluginInfo, u.topLevel);
|
self.remove_plugin_changes(pluginInfo, u.topLevel);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Now handle installation
|
// Now handle installation
|
||||||
platform_config.prepare_queue.installed.forEach(function(u) {
|
platform_config.prepare_queue.installed.forEach(function(u) {
|
||||||
var pluginInfo = self.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
|
var pluginInfo = self.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
|
||||||
self.add_plugin_changes(pluginInfo, u.vars, u.topLevel, true);
|
self.add_plugin_changes(pluginInfo, u.vars, u.topLevel, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Empty out installed/ uninstalled queues.
|
// Empty out installed/ uninstalled queues.
|
||||||
platform_config.prepare_queue.uninstalled = [];
|
platform_config.prepare_queue.uninstalled = [];
|
||||||
platform_config.prepare_queue.installed = [];
|
platform_config.prepare_queue.installed = [];
|
||||||
}
|
}
|
||||||
/**** END of PlatformMunger ****/
|
/**** END of PlatformMunger ****/
|
||||||
|
416
node_modules/cordova-common/src/ConfigChanges/ConfigFile.js
generated
vendored
416
node_modules/cordova-common/src/ConfigChanges/ConfigFile.js
generated
vendored
@ -1,208 +1,208 @@
|
|||||||
/*
|
/*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
var bplist = require('bplist-parser');
|
var bplist = require('bplist-parser');
|
||||||
var et = require('elementtree');
|
var et = require('elementtree');
|
||||||
var glob = require('glob');
|
var glob = require('glob');
|
||||||
var plist = require('plist');
|
var plist = require('plist');
|
||||||
|
|
||||||
var plist_helpers = require('../util/plist-helpers');
|
var plist_helpers = require('../util/plist-helpers');
|
||||||
var xml_helpers = require('../util/xml-helpers');
|
var xml_helpers = require('../util/xml-helpers');
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* ConfigFile class
|
* ConfigFile class
|
||||||
*
|
*
|
||||||
* Can load and keep various types of config files. Provides some functionality
|
* Can load and keep various types of config files. Provides some functionality
|
||||||
* specific to some file types such as grafting XML children. In most cases it
|
* specific to some file types such as grafting XML children. In most cases it
|
||||||
* should be instantiated by ConfigKeeper.
|
* should be instantiated by ConfigKeeper.
|
||||||
*
|
*
|
||||||
* For plugin.xml files use as:
|
* For plugin.xml files use as:
|
||||||
* plugin_config = self.config_keeper.get(plugin_dir, '', 'plugin.xml');
|
* plugin_config = self.config_keeper.get(plugin_dir, '', 'plugin.xml');
|
||||||
*
|
*
|
||||||
* TODO: Consider moving it out to a separate file and maybe partially with
|
* TODO: Consider moving it out to a separate file and maybe partially with
|
||||||
* overrides in platform handlers.
|
* overrides in platform handlers.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
function ConfigFile(project_dir, platform, file_tag) {
|
function ConfigFile(project_dir, platform, file_tag) {
|
||||||
this.project_dir = project_dir;
|
this.project_dir = project_dir;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.file_tag = file_tag;
|
this.file_tag = file_tag;
|
||||||
this.is_changed = false;
|
this.is_changed = false;
|
||||||
|
|
||||||
this.load();
|
this.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfigFile.load()
|
// ConfigFile.load()
|
||||||
ConfigFile.prototype.load = ConfigFile_load;
|
ConfigFile.prototype.load = ConfigFile_load;
|
||||||
function ConfigFile_load() {
|
function ConfigFile_load() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// config file may be in a place not exactly specified in the target
|
// config file may be in a place not exactly specified in the target
|
||||||
var filepath = self.filepath = resolveConfigFilePath(self.project_dir, self.platform, self.file_tag);
|
var filepath = self.filepath = resolveConfigFilePath(self.project_dir, self.platform, self.file_tag);
|
||||||
|
|
||||||
if ( !filepath || !fs.existsSync(filepath) ) {
|
if ( !filepath || !fs.existsSync(filepath) ) {
|
||||||
self.exists = false;
|
self.exists = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self.exists = true;
|
self.exists = true;
|
||||||
self.mtime = fs.statSync(self.filepath).mtime;
|
self.mtime = fs.statSync(self.filepath).mtime;
|
||||||
|
|
||||||
var ext = path.extname(filepath);
|
var ext = path.extname(filepath);
|
||||||
// Windows8 uses an appxmanifest, and wp8 will likely use
|
// Windows8 uses an appxmanifest, and wp8 will likely use
|
||||||
// the same in a future release
|
// the same in a future release
|
||||||
if (ext == '.xml' || ext == '.appxmanifest') {
|
if (ext == '.xml' || ext == '.appxmanifest') {
|
||||||
self.type = 'xml';
|
self.type = 'xml';
|
||||||
self.data = xml_helpers.parseElementtreeSync(filepath);
|
self.data = xml_helpers.parseElementtreeSync(filepath);
|
||||||
} else {
|
} else {
|
||||||
// plist file
|
// plist file
|
||||||
self.type = 'plist';
|
self.type = 'plist';
|
||||||
// TODO: isBinaryPlist() reads the file and then parse re-reads it again.
|
// TODO: isBinaryPlist() reads the file and then parse re-reads it again.
|
||||||
// We always write out text plist, not binary.
|
// We always write out text plist, not binary.
|
||||||
// Do we still need to support binary plist?
|
// Do we still need to support binary plist?
|
||||||
// If yes, use plist.parseStringSync() and read the file once.
|
// If yes, use plist.parseStringSync() and read the file once.
|
||||||
self.data = isBinaryPlist(filepath) ?
|
self.data = isBinaryPlist(filepath) ?
|
||||||
bplist.parseBuffer(fs.readFileSync(filepath)) :
|
bplist.parseBuffer(fs.readFileSync(filepath)) :
|
||||||
plist.parse(fs.readFileSync(filepath, 'utf8'));
|
plist.parse(fs.readFileSync(filepath, 'utf8'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigFile.prototype.save = function ConfigFile_save() {
|
ConfigFile.prototype.save = function ConfigFile_save() {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (self.type === 'xml') {
|
if (self.type === 'xml') {
|
||||||
fs.writeFileSync(self.filepath, self.data.write({indent: 4}), 'utf-8');
|
fs.writeFileSync(self.filepath, self.data.write({indent: 4}), 'utf-8');
|
||||||
} else {
|
} else {
|
||||||
// plist
|
// plist
|
||||||
var regExp = new RegExp('<string>[ \t\r\n]+?</string>', 'g');
|
var regExp = new RegExp('<string>[ \t\r\n]+?</string>', 'g');
|
||||||
fs.writeFileSync(self.filepath, plist.build(self.data).replace(regExp, '<string></string>'));
|
fs.writeFileSync(self.filepath, plist.build(self.data).replace(regExp, '<string></string>'));
|
||||||
}
|
}
|
||||||
self.is_changed = false;
|
self.is_changed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
ConfigFile.prototype.graft_child = function ConfigFile_graft_child(selector, xml_child) {
|
ConfigFile.prototype.graft_child = function ConfigFile_graft_child(selector, xml_child) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var filepath = self.filepath;
|
var filepath = self.filepath;
|
||||||
var result;
|
var result;
|
||||||
if (self.type === 'xml') {
|
if (self.type === 'xml') {
|
||||||
var xml_to_graft = [et.XML(xml_child.xml)];
|
var xml_to_graft = [et.XML(xml_child.xml)];
|
||||||
result = xml_helpers.graftXML(self.data, xml_to_graft, selector, xml_child.after);
|
result = xml_helpers.graftXML(self.data, xml_to_graft, selector, xml_child.after);
|
||||||
if ( !result) {
|
if ( !result) {
|
||||||
throw new Error('grafting xml at selector "' + selector + '" from "' + filepath + '" during config install went bad :(');
|
throw new Error('grafting xml at selector "' + selector + '" from "' + filepath + '" during config install went bad :(');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// plist file
|
// plist file
|
||||||
result = plist_helpers.graftPLIST(self.data, xml_child.xml, selector);
|
result = plist_helpers.graftPLIST(self.data, xml_child.xml, selector);
|
||||||
if ( !result ) {
|
if ( !result ) {
|
||||||
throw new Error('grafting to plist "' + filepath + '" during config install went bad :(');
|
throw new Error('grafting to plist "' + filepath + '" during config install went bad :(');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.is_changed = true;
|
self.is_changed = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
ConfigFile.prototype.prune_child = function ConfigFile_prune_child(selector, xml_child) {
|
ConfigFile.prototype.prune_child = function ConfigFile_prune_child(selector, xml_child) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var filepath = self.filepath;
|
var filepath = self.filepath;
|
||||||
var result;
|
var result;
|
||||||
if (self.type === 'xml') {
|
if (self.type === 'xml') {
|
||||||
var xml_to_graft = [et.XML(xml_child.xml)];
|
var xml_to_graft = [et.XML(xml_child.xml)];
|
||||||
result = xml_helpers.pruneXML(self.data, xml_to_graft, selector);
|
result = xml_helpers.pruneXML(self.data, xml_to_graft, selector);
|
||||||
} else {
|
} else {
|
||||||
// plist file
|
// plist file
|
||||||
result = plist_helpers.prunePLIST(self.data, xml_child.xml, selector);
|
result = plist_helpers.prunePLIST(self.data, xml_child.xml, selector);
|
||||||
}
|
}
|
||||||
if (!result) {
|
if (!result) {
|
||||||
var err_msg = 'Pruning at selector "' + selector + '" from "' + filepath + '" went bad.';
|
var err_msg = 'Pruning at selector "' + selector + '" from "' + filepath + '" went bad.';
|
||||||
throw new Error(err_msg);
|
throw new Error(err_msg);
|
||||||
}
|
}
|
||||||
self.is_changed = true;
|
self.is_changed = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Some config-file target attributes are not qualified with a full leading directory, or contain wildcards.
|
// Some config-file target attributes are not qualified with a full leading directory, or contain wildcards.
|
||||||
// Resolve to a real path in this function.
|
// Resolve to a real path in this function.
|
||||||
// TODO: getIOSProjectname is slow because of glob, try to avoid calling it several times per project.
|
// TODO: getIOSProjectname is slow because of glob, try to avoid calling it several times per project.
|
||||||
function resolveConfigFilePath(project_dir, platform, file) {
|
function resolveConfigFilePath(project_dir, platform, file) {
|
||||||
var filepath = path.join(project_dir, file);
|
var filepath = path.join(project_dir, file);
|
||||||
var matches;
|
var matches;
|
||||||
|
|
||||||
if (file.indexOf('*') > -1) {
|
if (file.indexOf('*') > -1) {
|
||||||
// handle wildcards in targets using glob.
|
// handle wildcards in targets using glob.
|
||||||
matches = glob.sync(path.join(project_dir, '**', file));
|
matches = glob.sync(path.join(project_dir, '**', file));
|
||||||
if (matches.length) filepath = matches[0];
|
if (matches.length) filepath = matches[0];
|
||||||
|
|
||||||
// [CB-5989] multiple Info.plist files may exist. default to $PROJECT_NAME-Info.plist
|
// [CB-5989] multiple Info.plist files may exist. default to $PROJECT_NAME-Info.plist
|
||||||
if(matches.length > 1 && file.indexOf('-Info.plist')>-1){
|
if(matches.length > 1 && file.indexOf('-Info.plist')>-1){
|
||||||
var plistName = getIOSProjectname(project_dir)+'-Info.plist';
|
var plistName = getIOSProjectname(project_dir)+'-Info.plist';
|
||||||
for (var i=0; i < matches.length; i++) {
|
for (var i=0; i < matches.length; i++) {
|
||||||
if(matches[i].indexOf(plistName) > -1){
|
if(matches[i].indexOf(plistName) > -1){
|
||||||
filepath = matches[i];
|
filepath = matches[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filepath;
|
return filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// special-case config.xml target that is just "config.xml". This should be resolved to the real location of the file.
|
// special-case config.xml target that is just "config.xml". This should be resolved to the real location of the file.
|
||||||
// TODO: move the logic that contains the locations of config.xml from cordova CLI into plugman.
|
// TODO: move the logic that contains the locations of config.xml from cordova CLI into plugman.
|
||||||
if (file == 'config.xml') {
|
if (file == 'config.xml') {
|
||||||
if (platform == 'ubuntu') {
|
if (platform == 'ubuntu') {
|
||||||
filepath = path.join(project_dir, 'config.xml');
|
filepath = path.join(project_dir, 'config.xml');
|
||||||
} else if (platform == 'ios') {
|
} else if (platform == 'ios') {
|
||||||
var iospath = getIOSProjectname(project_dir);
|
var iospath = getIOSProjectname(project_dir);
|
||||||
filepath = path.join(project_dir,iospath, 'config.xml');
|
filepath = path.join(project_dir,iospath, 'config.xml');
|
||||||
} else if (platform == 'android') {
|
} else if (platform == 'android') {
|
||||||
filepath = path.join(project_dir, 'res', 'xml', 'config.xml');
|
filepath = path.join(project_dir, 'res', 'xml', 'config.xml');
|
||||||
} else {
|
} else {
|
||||||
matches = glob.sync(path.join(project_dir, '**', 'config.xml'));
|
matches = glob.sync(path.join(project_dir, '**', 'config.xml'));
|
||||||
if (matches.length) filepath = matches[0];
|
if (matches.length) filepath = matches[0];
|
||||||
}
|
}
|
||||||
return filepath;
|
return filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// None of the special cases matched, returning project_dir/file.
|
// None of the special cases matched, returning project_dir/file.
|
||||||
return filepath;
|
return filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find out the real name of an iOS project
|
// Find out the real name of an iOS project
|
||||||
// TODO: glob is slow, need a better way or caching, or avoid using more than once.
|
// TODO: glob is slow, need a better way or caching, or avoid using more than once.
|
||||||
function getIOSProjectname(project_dir) {
|
function getIOSProjectname(project_dir) {
|
||||||
var matches = glob.sync(path.join(project_dir, '*.xcodeproj'));
|
var matches = glob.sync(path.join(project_dir, '*.xcodeproj'));
|
||||||
var iospath;
|
var iospath;
|
||||||
if (matches.length === 1) {
|
if (matches.length === 1) {
|
||||||
iospath = path.basename(matches[0],'.xcodeproj');
|
iospath = path.basename(matches[0],'.xcodeproj');
|
||||||
} else {
|
} else {
|
||||||
var msg;
|
var msg;
|
||||||
if (matches.length === 0) {
|
if (matches.length === 0) {
|
||||||
msg = 'Does not appear to be an xcode project, no xcode project file in ' + project_dir;
|
msg = 'Does not appear to be an xcode project, no xcode project file in ' + project_dir;
|
||||||
} else {
|
} else {
|
||||||
msg = 'There are multiple *.xcodeproj dirs in ' + project_dir;
|
msg = 'There are multiple *.xcodeproj dirs in ' + project_dir;
|
||||||
}
|
}
|
||||||
throw new Error(msg);
|
throw new Error(msg);
|
||||||
}
|
}
|
||||||
return iospath;
|
return iospath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine if a plist file is binary
|
// determine if a plist file is binary
|
||||||
function isBinaryPlist(filename) {
|
function isBinaryPlist(filename) {
|
||||||
// I wish there was a synchronous way to read only the first 6 bytes of a
|
// I wish there was a synchronous way to read only the first 6 bytes of a
|
||||||
// file. This is wasteful :/
|
// file. This is wasteful :/
|
||||||
var buf = '' + fs.readFileSync(filename, 'utf8');
|
var buf = '' + fs.readFileSync(filename, 'utf8');
|
||||||
// binary plists start with a magic header, "bplist"
|
// binary plists start with a magic header, "bplist"
|
||||||
return buf.substring(0, 6) === 'bplist';
|
return buf.substring(0, 6) === 'bplist';
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ConfigFile;
|
module.exports = ConfigFile;
|
||||||
|
130
node_modules/cordova-common/src/ConfigChanges/ConfigKeeper.js
generated
vendored
130
node_modules/cordova-common/src/ConfigChanges/ConfigKeeper.js
generated
vendored
@ -1,65 +1,65 @@
|
|||||||
/*
|
/*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/* jshint sub:true */
|
/* jshint sub:true */
|
||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var ConfigFile = require('./ConfigFile');
|
var ConfigFile = require('./ConfigFile');
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* ConfigKeeper class
|
* ConfigKeeper class
|
||||||
*
|
*
|
||||||
* Used to load and store config files to avoid re-parsing and writing them out
|
* Used to load and store config files to avoid re-parsing and writing them out
|
||||||
* multiple times.
|
* multiple times.
|
||||||
*
|
*
|
||||||
* The config files are referred to by a fake path constructed as
|
* The config files are referred to by a fake path constructed as
|
||||||
* project_dir/platform/file
|
* project_dir/platform/file
|
||||||
* where file is the name used for the file in config munges.
|
* where file is the name used for the file in config munges.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
function ConfigKeeper(project_dir, plugins_dir) {
|
function ConfigKeeper(project_dir, plugins_dir) {
|
||||||
this.project_dir = project_dir;
|
this.project_dir = project_dir;
|
||||||
this.plugins_dir = plugins_dir;
|
this.plugins_dir = plugins_dir;
|
||||||
this._cached = {};
|
this._cached = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigKeeper.prototype.get = function ConfigKeeper_get(project_dir, platform, file) {
|
ConfigKeeper.prototype.get = function ConfigKeeper_get(project_dir, platform, file) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// This fixes a bug with older plugins - when specifying config xml instead of res/xml/config.xml
|
// This fixes a bug with older plugins - when specifying config xml instead of res/xml/config.xml
|
||||||
// https://issues.apache.org/jira/browse/CB-6414
|
// https://issues.apache.org/jira/browse/CB-6414
|
||||||
if(file == 'config.xml' && platform == 'android'){
|
if(file == 'config.xml' && platform == 'android'){
|
||||||
file = 'res/xml/config.xml';
|
file = 'res/xml/config.xml';
|
||||||
}
|
}
|
||||||
var fake_path = path.join(project_dir, platform, file);
|
var fake_path = path.join(project_dir, platform, file);
|
||||||
|
|
||||||
if (self._cached[fake_path]) {
|
if (self._cached[fake_path]) {
|
||||||
return self._cached[fake_path];
|
return self._cached[fake_path];
|
||||||
}
|
}
|
||||||
// File was not cached, need to load.
|
// File was not cached, need to load.
|
||||||
var config_file = new ConfigFile(project_dir, platform, file);
|
var config_file = new ConfigFile(project_dir, platform, file);
|
||||||
self._cached[fake_path] = config_file;
|
self._cached[fake_path] = config_file;
|
||||||
return config_file;
|
return config_file;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ConfigKeeper.prototype.save_all = function ConfigKeeper_save_all() {
|
ConfigKeeper.prototype.save_all = function ConfigKeeper_save_all() {
|
||||||
var self = this;
|
var self = this;
|
||||||
Object.keys(self._cached).forEach(function (fake_path) {
|
Object.keys(self._cached).forEach(function (fake_path) {
|
||||||
var config_file = self._cached[fake_path];
|
var config_file = self._cached[fake_path];
|
||||||
if (config_file.is_changed) config_file.save();
|
if (config_file.is_changed) config_file.save();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ConfigKeeper;
|
module.exports = ConfigKeeper;
|
||||||
|
320
node_modules/cordova-common/src/ConfigChanges/munge-util.js
generated
vendored
320
node_modules/cordova-common/src/ConfigChanges/munge-util.js
generated
vendored
@ -1,160 +1,160 @@
|
|||||||
/*
|
/*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/* jshint sub:true */
|
/* jshint sub:true */
|
||||||
|
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
|
|
||||||
// add the count of [key1][key2]...[keyN] to obj
|
// add the count of [key1][key2]...[keyN] to obj
|
||||||
// return true if it didn't exist before
|
// return true if it didn't exist before
|
||||||
exports.deep_add = function deep_add(obj, keys /* or key1, key2 .... */ ) {
|
exports.deep_add = function deep_add(obj, keys /* or key1, key2 .... */ ) {
|
||||||
if ( !Array.isArray(keys) ) {
|
if ( !Array.isArray(keys) ) {
|
||||||
keys = Array.prototype.slice.call(arguments, 1);
|
keys = Array.prototype.slice.call(arguments, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return exports.process_munge(obj, true/*createParents*/, function (parentArray, k) {
|
return exports.process_munge(obj, true/*createParents*/, function (parentArray, k) {
|
||||||
var found = _.find(parentArray, function(element) {
|
var found = _.find(parentArray, function(element) {
|
||||||
return element.xml == k.xml;
|
return element.xml == k.xml;
|
||||||
});
|
});
|
||||||
if (found) {
|
if (found) {
|
||||||
found.after = found.after || k.after;
|
found.after = found.after || k.after;
|
||||||
found.count += k.count;
|
found.count += k.count;
|
||||||
} else {
|
} else {
|
||||||
parentArray.push(k);
|
parentArray.push(k);
|
||||||
}
|
}
|
||||||
return !found;
|
return !found;
|
||||||
}, keys);
|
}, keys);
|
||||||
};
|
};
|
||||||
|
|
||||||
// decrement the count of [key1][key2]...[keyN] from obj and remove if it reaches 0
|
// decrement the count of [key1][key2]...[keyN] from obj and remove if it reaches 0
|
||||||
// return true if it was removed or not found
|
// return true if it was removed or not found
|
||||||
exports.deep_remove = function deep_remove(obj, keys /* or key1, key2 .... */ ) {
|
exports.deep_remove = function deep_remove(obj, keys /* or key1, key2 .... */ ) {
|
||||||
if ( !Array.isArray(keys) ) {
|
if ( !Array.isArray(keys) ) {
|
||||||
keys = Array.prototype.slice.call(arguments, 1);
|
keys = Array.prototype.slice.call(arguments, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = exports.process_munge(obj, false/*createParents*/, function (parentArray, k) {
|
var result = exports.process_munge(obj, false/*createParents*/, function (parentArray, k) {
|
||||||
var index = -1;
|
var index = -1;
|
||||||
var found = _.find(parentArray, function (element) {
|
var found = _.find(parentArray, function (element) {
|
||||||
index++;
|
index++;
|
||||||
return element.xml == k.xml;
|
return element.xml == k.xml;
|
||||||
});
|
});
|
||||||
if (found) {
|
if (found) {
|
||||||
found.count -= k.count;
|
found.count -= k.count;
|
||||||
if (found.count > 0) {
|
if (found.count > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parentArray.splice(index, 1);
|
parentArray.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}, keys);
|
}, keys);
|
||||||
|
|
||||||
return typeof result === 'undefined' ? true : result;
|
return typeof result === 'undefined' ? true : result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// search for [key1][key2]...[keyN]
|
// search for [key1][key2]...[keyN]
|
||||||
// return the object or undefined if not found
|
// return the object or undefined if not found
|
||||||
exports.deep_find = function deep_find(obj, keys /* or key1, key2 .... */ ) {
|
exports.deep_find = function deep_find(obj, keys /* or key1, key2 .... */ ) {
|
||||||
if ( !Array.isArray(keys) ) {
|
if ( !Array.isArray(keys) ) {
|
||||||
keys = Array.prototype.slice.call(arguments, 1);
|
keys = Array.prototype.slice.call(arguments, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return exports.process_munge(obj, false/*createParents?*/, function (parentArray, k) {
|
return exports.process_munge(obj, false/*createParents?*/, function (parentArray, k) {
|
||||||
return _.find(parentArray, function (element) {
|
return _.find(parentArray, function (element) {
|
||||||
return element.xml == (k.xml || k);
|
return element.xml == (k.xml || k);
|
||||||
});
|
});
|
||||||
}, keys);
|
}, keys);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Execute func passing it the parent array and the xmlChild key.
|
// Execute func passing it the parent array and the xmlChild key.
|
||||||
// When createParents is true, add the file and parent items they are missing
|
// When createParents is true, add the file and parent items they are missing
|
||||||
// When createParents is false, stop and return undefined if the file and/or parent items are missing
|
// When createParents is false, stop and return undefined if the file and/or parent items are missing
|
||||||
|
|
||||||
exports.process_munge = function process_munge(obj, createParents, func, keys /* or key1, key2 .... */ ) {
|
exports.process_munge = function process_munge(obj, createParents, func, keys /* or key1, key2 .... */ ) {
|
||||||
if ( !Array.isArray(keys) ) {
|
if ( !Array.isArray(keys) ) {
|
||||||
keys = Array.prototype.slice.call(arguments, 1);
|
keys = Array.prototype.slice.call(arguments, 1);
|
||||||
}
|
}
|
||||||
var k = keys[0];
|
var k = keys[0];
|
||||||
if (keys.length == 1) {
|
if (keys.length == 1) {
|
||||||
return func(obj, k);
|
return func(obj, k);
|
||||||
} else if (keys.length == 2) {
|
} else if (keys.length == 2) {
|
||||||
if (!obj.parents[k] && !createParents) {
|
if (!obj.parents[k] && !createParents) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
obj.parents[k] = obj.parents[k] || [];
|
obj.parents[k] = obj.parents[k] || [];
|
||||||
return exports.process_munge(obj.parents[k], createParents, func, keys.slice(1));
|
return exports.process_munge(obj.parents[k], createParents, func, keys.slice(1));
|
||||||
} else if (keys.length == 3){
|
} else if (keys.length == 3){
|
||||||
if (!obj.files[k] && !createParents) {
|
if (!obj.files[k] && !createParents) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
obj.files[k] = obj.files[k] || { parents: {} };
|
obj.files[k] = obj.files[k] || { parents: {} };
|
||||||
return exports.process_munge(obj.files[k], createParents, func, keys.slice(1));
|
return exports.process_munge(obj.files[k], createParents, func, keys.slice(1));
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid key format. Must contain at most 3 elements (file, parent, xmlChild).');
|
throw new Error('Invalid key format. Must contain at most 3 elements (file, parent, xmlChild).');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// All values from munge are added to base as
|
// All values from munge are added to base as
|
||||||
// base[file][selector][child] += munge[file][selector][child]
|
// base[file][selector][child] += munge[file][selector][child]
|
||||||
// Returns a munge object containing values that exist in munge
|
// Returns a munge object containing values that exist in munge
|
||||||
// but not in base.
|
// but not in base.
|
||||||
exports.increment_munge = function increment_munge(base, munge) {
|
exports.increment_munge = function increment_munge(base, munge) {
|
||||||
var diff = { files: {} };
|
var diff = { files: {} };
|
||||||
|
|
||||||
for (var file in munge.files) {
|
for (var file in munge.files) {
|
||||||
for (var selector in munge.files[file].parents) {
|
for (var selector in munge.files[file].parents) {
|
||||||
for (var xml_child in munge.files[file].parents[selector]) {
|
for (var xml_child in munge.files[file].parents[selector]) {
|
||||||
var val = munge.files[file].parents[selector][xml_child];
|
var val = munge.files[file].parents[selector][xml_child];
|
||||||
// if node not in base, add it to diff and base
|
// if node not in base, add it to diff and base
|
||||||
// else increment it's value in base without adding to diff
|
// else increment it's value in base without adding to diff
|
||||||
var newlyAdded = exports.deep_add(base, [file, selector, val]);
|
var newlyAdded = exports.deep_add(base, [file, selector, val]);
|
||||||
if (newlyAdded) {
|
if (newlyAdded) {
|
||||||
exports.deep_add(diff, file, selector, val);
|
exports.deep_add(diff, file, selector, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return diff;
|
return diff;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update the base munge object as
|
// Update the base munge object as
|
||||||
// base[file][selector][child] -= munge[file][selector][child]
|
// base[file][selector][child] -= munge[file][selector][child]
|
||||||
// nodes that reached zero value are removed from base and added to the returned munge
|
// nodes that reached zero value are removed from base and added to the returned munge
|
||||||
// object.
|
// object.
|
||||||
exports.decrement_munge = function decrement_munge(base, munge) {
|
exports.decrement_munge = function decrement_munge(base, munge) {
|
||||||
var zeroed = { files: {} };
|
var zeroed = { files: {} };
|
||||||
|
|
||||||
for (var file in munge.files) {
|
for (var file in munge.files) {
|
||||||
for (var selector in munge.files[file].parents) {
|
for (var selector in munge.files[file].parents) {
|
||||||
for (var xml_child in munge.files[file].parents[selector]) {
|
for (var xml_child in munge.files[file].parents[selector]) {
|
||||||
var val = munge.files[file].parents[selector][xml_child];
|
var val = munge.files[file].parents[selector][xml_child];
|
||||||
// if node not in base, add it to diff and base
|
// if node not in base, add it to diff and base
|
||||||
// else increment it's value in base without adding to diff
|
// else increment it's value in base without adding to diff
|
||||||
var removed = exports.deep_remove(base, [file, selector, val]);
|
var removed = exports.deep_remove(base, [file, selector, val]);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
exports.deep_add(zeroed, file, selector, val);
|
exports.deep_add(zeroed, file, selector, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return zeroed;
|
return zeroed;
|
||||||
};
|
};
|
||||||
|
|
||||||
// For better readability where used
|
// For better readability where used
|
||||||
exports.clone_munge = function clone_munge(munge) {
|
exports.clone_munge = function clone_munge(munge) {
|
||||||
return exports.increment_munge({}, munge);
|
return exports.increment_munge({}, munge);
|
||||||
};
|
};
|
||||||
|
998
node_modules/cordova-common/src/ConfigParser/ConfigParser.js
generated
vendored
998
node_modules/cordova-common/src/ConfigParser/ConfigParser.js
generated
vendored
@ -1,499 +1,499 @@
|
|||||||
/**
|
/**
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint sub:true */
|
/* jshint sub:true */
|
||||||
|
|
||||||
var et = require('elementtree'),
|
var et = require('elementtree'),
|
||||||
xml= require('../util/xml-helpers'),
|
xml= require('../util/xml-helpers'),
|
||||||
CordovaError = require('../CordovaError/CordovaError'),
|
CordovaError = require('../CordovaError/CordovaError'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
events = require('../events');
|
events = require('../events');
|
||||||
|
|
||||||
|
|
||||||
/** Wraps a config.xml file */
|
/** Wraps a config.xml file */
|
||||||
function ConfigParser(path) {
|
function ConfigParser(path) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
try {
|
try {
|
||||||
this.doc = xml.parseElementtreeSync(path);
|
this.doc = xml.parseElementtreeSync(path);
|
||||||
this.cdvNamespacePrefix = getCordovaNamespacePrefix(this.doc);
|
this.cdvNamespacePrefix = getCordovaNamespacePrefix(this.doc);
|
||||||
et.register_namespace(this.cdvNamespacePrefix, 'http://cordova.apache.org/ns/1.0');
|
et.register_namespace(this.cdvNamespacePrefix, 'http://cordova.apache.org/ns/1.0');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Parsing '+path+' failed');
|
console.error('Parsing '+path+' failed');
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
var r = this.doc.getroot();
|
var r = this.doc.getroot();
|
||||||
if (r.tag !== 'widget') {
|
if (r.tag !== 'widget') {
|
||||||
throw new CordovaError(path + ' has incorrect root node name (expected "widget", was "' + r.tag + '")');
|
throw new CordovaError(path + ' has incorrect root node name (expected "widget", was "' + r.tag + '")');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNodeTextSafe(el) {
|
function getNodeTextSafe(el) {
|
||||||
return el && el.text && el.text.trim();
|
return el && el.text && el.text.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
function findOrCreate(doc, name) {
|
function findOrCreate(doc, name) {
|
||||||
var ret = doc.find(name);
|
var ret = doc.find(name);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = new et.Element(name);
|
ret = new et.Element(name);
|
||||||
doc.getroot().append(ret);
|
doc.getroot().append(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCordovaNamespacePrefix(doc){
|
function getCordovaNamespacePrefix(doc){
|
||||||
var rootAtribs = Object.getOwnPropertyNames(doc.getroot().attrib);
|
var rootAtribs = Object.getOwnPropertyNames(doc.getroot().attrib);
|
||||||
var prefix = 'cdv';
|
var prefix = 'cdv';
|
||||||
for (var j = 0; j < rootAtribs.length; j++ ) {
|
for (var j = 0; j < rootAtribs.length; j++ ) {
|
||||||
if(rootAtribs[j].indexOf('xmlns:') === 0 &&
|
if(rootAtribs[j].indexOf('xmlns:') === 0 &&
|
||||||
doc.getroot().attrib[rootAtribs[j]] === 'http://cordova.apache.org/ns/1.0'){
|
doc.getroot().attrib[rootAtribs[j]] === 'http://cordova.apache.org/ns/1.0'){
|
||||||
var strings = rootAtribs[j].split(':');
|
var strings = rootAtribs[j].split(':');
|
||||||
prefix = strings[1];
|
prefix = strings[1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the value of an element's attribute
|
* Finds the value of an element's attribute
|
||||||
* @param {String} attributeName Name of the attribute to search for
|
* @param {String} attributeName Name of the attribute to search for
|
||||||
* @param {Array} elems An array of ElementTree nodes
|
* @param {Array} elems An array of ElementTree nodes
|
||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
function findElementAttributeValue(attributeName, elems) {
|
function findElementAttributeValue(attributeName, elems) {
|
||||||
|
|
||||||
elems = Array.isArray(elems) ? elems : [ elems ];
|
elems = Array.isArray(elems) ? elems : [ elems ];
|
||||||
|
|
||||||
var value = elems.filter(function (elem) {
|
var value = elems.filter(function (elem) {
|
||||||
return elem.attrib.name.toLowerCase() === attributeName.toLowerCase();
|
return elem.attrib.name.toLowerCase() === attributeName.toLowerCase();
|
||||||
}).map(function (filteredElems) {
|
}).map(function (filteredElems) {
|
||||||
return filteredElems.attrib.value;
|
return filteredElems.attrib.value;
|
||||||
}).pop();
|
}).pop();
|
||||||
|
|
||||||
return value ? value : '';
|
return value ? value : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigParser.prototype = {
|
ConfigParser.prototype = {
|
||||||
packageName: function(id) {
|
packageName: function(id) {
|
||||||
return this.doc.getroot().attrib['id'];
|
return this.doc.getroot().attrib['id'];
|
||||||
},
|
},
|
||||||
setPackageName: function(id) {
|
setPackageName: function(id) {
|
||||||
this.doc.getroot().attrib['id'] = id;
|
this.doc.getroot().attrib['id'] = id;
|
||||||
},
|
},
|
||||||
android_packageName: function() {
|
android_packageName: function() {
|
||||||
return this.doc.getroot().attrib['android-packageName'];
|
return this.doc.getroot().attrib['android-packageName'];
|
||||||
},
|
},
|
||||||
android_activityName: function() {
|
android_activityName: function() {
|
||||||
return this.doc.getroot().attrib['android-activityName'];
|
return this.doc.getroot().attrib['android-activityName'];
|
||||||
},
|
},
|
||||||
ios_CFBundleIdentifier: function() {
|
ios_CFBundleIdentifier: function() {
|
||||||
return this.doc.getroot().attrib['ios-CFBundleIdentifier'];
|
return this.doc.getroot().attrib['ios-CFBundleIdentifier'];
|
||||||
},
|
},
|
||||||
name: function() {
|
name: function() {
|
||||||
return getNodeTextSafe(this.doc.find('name'));
|
return getNodeTextSafe(this.doc.find('name'));
|
||||||
},
|
},
|
||||||
setName: function(name) {
|
setName: function(name) {
|
||||||
var el = findOrCreate(this.doc, 'name');
|
var el = findOrCreate(this.doc, 'name');
|
||||||
el.text = name;
|
el.text = name;
|
||||||
},
|
},
|
||||||
description: function() {
|
description: function() {
|
||||||
return getNodeTextSafe(this.doc.find('description'));
|
return getNodeTextSafe(this.doc.find('description'));
|
||||||
},
|
},
|
||||||
setDescription: function(text) {
|
setDescription: function(text) {
|
||||||
var el = findOrCreate(this.doc, 'description');
|
var el = findOrCreate(this.doc, 'description');
|
||||||
el.text = text;
|
el.text = text;
|
||||||
},
|
},
|
||||||
version: function() {
|
version: function() {
|
||||||
return this.doc.getroot().attrib['version'];
|
return this.doc.getroot().attrib['version'];
|
||||||
},
|
},
|
||||||
windows_packageVersion: function() {
|
windows_packageVersion: function() {
|
||||||
return this.doc.getroot().attrib('windows-packageVersion');
|
return this.doc.getroot().attrib('windows-packageVersion');
|
||||||
},
|
},
|
||||||
android_versionCode: function() {
|
android_versionCode: function() {
|
||||||
return this.doc.getroot().attrib['android-versionCode'];
|
return this.doc.getroot().attrib['android-versionCode'];
|
||||||
},
|
},
|
||||||
ios_CFBundleVersion: function() {
|
ios_CFBundleVersion: function() {
|
||||||
return this.doc.getroot().attrib['ios-CFBundleVersion'];
|
return this.doc.getroot().attrib['ios-CFBundleVersion'];
|
||||||
},
|
},
|
||||||
setVersion: function(value) {
|
setVersion: function(value) {
|
||||||
this.doc.getroot().attrib['version'] = value;
|
this.doc.getroot().attrib['version'] = value;
|
||||||
},
|
},
|
||||||
author: function() {
|
author: function() {
|
||||||
return getNodeTextSafe(this.doc.find('author'));
|
return getNodeTextSafe(this.doc.find('author'));
|
||||||
},
|
},
|
||||||
getGlobalPreference: function (name) {
|
getGlobalPreference: function (name) {
|
||||||
return findElementAttributeValue(name, this.doc.findall('preference'));
|
return findElementAttributeValue(name, this.doc.findall('preference'));
|
||||||
},
|
},
|
||||||
setGlobalPreference: function (name, value) {
|
setGlobalPreference: function (name, value) {
|
||||||
var pref = this.doc.find('preference[@name="' + name + '"]');
|
var pref = this.doc.find('preference[@name="' + name + '"]');
|
||||||
if (!pref) {
|
if (!pref) {
|
||||||
pref = new et.Element('preference');
|
pref = new et.Element('preference');
|
||||||
pref.attrib.name = name;
|
pref.attrib.name = name;
|
||||||
this.doc.getroot().append(pref);
|
this.doc.getroot().append(pref);
|
||||||
}
|
}
|
||||||
pref.attrib.value = value;
|
pref.attrib.value = value;
|
||||||
},
|
},
|
||||||
getPlatformPreference: function (name, platform) {
|
getPlatformPreference: function (name, platform) {
|
||||||
return findElementAttributeValue(name, this.doc.findall('platform[@name=\'' + platform + '\']/preference'));
|
return findElementAttributeValue(name, this.doc.findall('platform[@name=\'' + platform + '\']/preference'));
|
||||||
},
|
},
|
||||||
getPreference: function(name, platform) {
|
getPreference: function(name, platform) {
|
||||||
|
|
||||||
var platformPreference = '';
|
var platformPreference = '';
|
||||||
|
|
||||||
if (platform) {
|
if (platform) {
|
||||||
platformPreference = this.getPlatformPreference(name, platform);
|
platformPreference = this.getPlatformPreference(name, platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
return platformPreference ? platformPreference : this.getGlobalPreference(name);
|
return platformPreference ? platformPreference : this.getGlobalPreference(name);
|
||||||
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Returns all resources for the platform specified.
|
* Returns all resources for the platform specified.
|
||||||
* @param {String} platform The platform.
|
* @param {String} platform The platform.
|
||||||
* @param {string} resourceName Type of static resources to return.
|
* @param {string} resourceName Type of static resources to return.
|
||||||
* "icon" and "splash" currently supported.
|
* "icon" and "splash" currently supported.
|
||||||
* @return {Array} Resources for the platform specified.
|
* @return {Array} Resources for the platform specified.
|
||||||
*/
|
*/
|
||||||
getStaticResources: function(platform, resourceName) {
|
getStaticResources: function(platform, resourceName) {
|
||||||
var ret = [],
|
var ret = [],
|
||||||
staticResources = [];
|
staticResources = [];
|
||||||
if (platform) { // platform specific icons
|
if (platform) { // platform specific icons
|
||||||
this.doc.findall('platform[@name=\'' + platform + '\']/' + resourceName).forEach(function(elt){
|
this.doc.findall('platform[@name=\'' + platform + '\']/' + resourceName).forEach(function(elt){
|
||||||
elt.platform = platform; // mark as platform specific resource
|
elt.platform = platform; // mark as platform specific resource
|
||||||
staticResources.push(elt);
|
staticResources.push(elt);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// root level resources
|
// root level resources
|
||||||
staticResources = staticResources.concat(this.doc.findall(resourceName));
|
staticResources = staticResources.concat(this.doc.findall(resourceName));
|
||||||
// parse resource elements
|
// parse resource elements
|
||||||
var that = this;
|
var that = this;
|
||||||
staticResources.forEach(function (elt) {
|
staticResources.forEach(function (elt) {
|
||||||
var res = {};
|
var res = {};
|
||||||
res.src = elt.attrib.src;
|
res.src = elt.attrib.src;
|
||||||
res.density = elt.attrib['density'] || elt.attrib[that.cdvNamespacePrefix+':density'] || elt.attrib['gap:density'];
|
res.density = elt.attrib['density'] || elt.attrib[that.cdvNamespacePrefix+':density'] || elt.attrib['gap:density'];
|
||||||
res.platform = elt.platform || null; // null means icon represents default icon (shared between platforms)
|
res.platform = elt.platform || null; // null means icon represents default icon (shared between platforms)
|
||||||
res.width = +elt.attrib.width || undefined;
|
res.width = +elt.attrib.width || undefined;
|
||||||
res.height = +elt.attrib.height || undefined;
|
res.height = +elt.attrib.height || undefined;
|
||||||
|
|
||||||
// default icon
|
// default icon
|
||||||
if (!res.width && !res.height && !res.density) {
|
if (!res.width && !res.height && !res.density) {
|
||||||
ret.defaultResource = res;
|
ret.defaultResource = res;
|
||||||
}
|
}
|
||||||
ret.push(res);
|
ret.push(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns resource with specified width and/or height.
|
* Returns resource with specified width and/or height.
|
||||||
* @param {number} width Width of resource.
|
* @param {number} width Width of resource.
|
||||||
* @param {number} height Height of resource.
|
* @param {number} height Height of resource.
|
||||||
* @return {Resource} Resource object or null if not found.
|
* @return {Resource} Resource object or null if not found.
|
||||||
*/
|
*/
|
||||||
ret.getBySize = function(width, height) {
|
ret.getBySize = function(width, height) {
|
||||||
return ret.filter(function(res) {
|
return ret.filter(function(res) {
|
||||||
if (!res.width && !res.height) {
|
if (!res.width && !res.height) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return ((!res.width || (width == res.width)) &&
|
return ((!res.width || (width == res.width)) &&
|
||||||
(!res.height || (height == res.height)));
|
(!res.height || (height == res.height)));
|
||||||
})[0] || null;
|
})[0] || null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns resource with specified density.
|
* Returns resource with specified density.
|
||||||
* @param {string} density Density of resource.
|
* @param {string} density Density of resource.
|
||||||
* @return {Resource} Resource object or null if not found.
|
* @return {Resource} Resource object or null if not found.
|
||||||
*/
|
*/
|
||||||
ret.getByDensity = function(density) {
|
ret.getByDensity = function(density) {
|
||||||
return ret.filter(function(res) {
|
return ret.filter(function(res) {
|
||||||
return res.density == density;
|
return res.density == density;
|
||||||
})[0] || null;
|
})[0] || null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Returns default icons */
|
/** Returns default icons */
|
||||||
ret.getDefault = function() {
|
ret.getDefault = function() {
|
||||||
return ret.defaultResource;
|
return ret.defaultResource;
|
||||||
};
|
};
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all icons for specific platform.
|
* Returns all icons for specific platform.
|
||||||
* @param {string} platform Platform name
|
* @param {string} platform Platform name
|
||||||
* @return {Resource[]} Array of icon objects.
|
* @return {Resource[]} Array of icon objects.
|
||||||
*/
|
*/
|
||||||
getIcons: function(platform) {
|
getIcons: function(platform) {
|
||||||
return this.getStaticResources(platform, 'icon');
|
return this.getStaticResources(platform, 'icon');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all splash images for specific platform.
|
* Returns all splash images for specific platform.
|
||||||
* @param {string} platform Platform name
|
* @param {string} platform Platform name
|
||||||
* @return {Resource[]} Array of Splash objects.
|
* @return {Resource[]} Array of Splash objects.
|
||||||
*/
|
*/
|
||||||
getSplashScreens: function(platform) {
|
getSplashScreens: function(platform) {
|
||||||
return this.getStaticResources(platform, 'splash');
|
return this.getStaticResources(platform, 'splash');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all hook scripts for the hook type specified.
|
* Returns all hook scripts for the hook type specified.
|
||||||
* @param {String} hook The hook type.
|
* @param {String} hook The hook type.
|
||||||
* @param {Array} platforms Platforms to look for scripts into (root scripts will be included as well).
|
* @param {Array} platforms Platforms to look for scripts into (root scripts will be included as well).
|
||||||
* @return {Array} Script elements.
|
* @return {Array} Script elements.
|
||||||
*/
|
*/
|
||||||
getHookScripts: function(hook, platforms) {
|
getHookScripts: function(hook, platforms) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var scriptElements = self.doc.findall('./hook');
|
var scriptElements = self.doc.findall('./hook');
|
||||||
|
|
||||||
if(platforms) {
|
if(platforms) {
|
||||||
platforms.forEach(function (platform) {
|
platforms.forEach(function (platform) {
|
||||||
scriptElements = scriptElements.concat(self.doc.findall('./platform[@name="' + platform + '"]/hook'));
|
scriptElements = scriptElements.concat(self.doc.findall('./platform[@name="' + platform + '"]/hook'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterScriptByHookType(el) {
|
function filterScriptByHookType(el) {
|
||||||
return el.attrib.src && el.attrib.type && el.attrib.type.toLowerCase() === hook;
|
return el.attrib.src && el.attrib.type && el.attrib.type.toLowerCase() === hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
return scriptElements.filter(filterScriptByHookType);
|
return scriptElements.filter(filterScriptByHookType);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Returns a list of plugin (IDs).
|
* Returns a list of plugin (IDs).
|
||||||
*
|
*
|
||||||
* This function also returns any plugin's that
|
* This function also returns any plugin's that
|
||||||
* were defined using the legacy <feature> tags.
|
* were defined using the legacy <feature> tags.
|
||||||
* @return {string[]} Array of plugin IDs
|
* @return {string[]} Array of plugin IDs
|
||||||
*/
|
*/
|
||||||
getPluginIdList: function () {
|
getPluginIdList: function () {
|
||||||
var plugins = this.doc.findall('plugin');
|
var plugins = this.doc.findall('plugin');
|
||||||
var result = plugins.map(function(plugin){
|
var result = plugins.map(function(plugin){
|
||||||
return plugin.attrib.name;
|
return plugin.attrib.name;
|
||||||
});
|
});
|
||||||
var features = this.doc.findall('feature');
|
var features = this.doc.findall('feature');
|
||||||
features.forEach(function(element ){
|
features.forEach(function(element ){
|
||||||
var idTag = element.find('./param[@name="id"]');
|
var idTag = element.find('./param[@name="id"]');
|
||||||
if(idTag){
|
if(idTag){
|
||||||
result.push(idTag.attrib.value);
|
result.push(idTag.attrib.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
getPlugins: function () {
|
getPlugins: function () {
|
||||||
return this.getPluginIdList().map(function (pluginId) {
|
return this.getPluginIdList().map(function (pluginId) {
|
||||||
return this.getPlugin(pluginId);
|
return this.getPlugin(pluginId);
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Adds a plugin element. Does not check for duplicates.
|
* Adds a plugin element. Does not check for duplicates.
|
||||||
* @name addPlugin
|
* @name addPlugin
|
||||||
* @function
|
* @function
|
||||||
* @param {object} attributes name and spec are supported
|
* @param {object} attributes name and spec are supported
|
||||||
* @param {Array|object} variables name, value or arbitary object
|
* @param {Array|object} variables name, value or arbitary object
|
||||||
*/
|
*/
|
||||||
addPlugin: function (attributes, variables) {
|
addPlugin: function (attributes, variables) {
|
||||||
if (!attributes && !attributes.name) return;
|
if (!attributes && !attributes.name) return;
|
||||||
var el = new et.Element('plugin');
|
var el = new et.Element('plugin');
|
||||||
el.attrib.name = attributes.name;
|
el.attrib.name = attributes.name;
|
||||||
if (attributes.spec) {
|
if (attributes.spec) {
|
||||||
el.attrib.spec = attributes.spec;
|
el.attrib.spec = attributes.spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
// support arbitrary object as variables source
|
// support arbitrary object as variables source
|
||||||
if (variables && typeof variables === 'object' && !Array.isArray(variables)) {
|
if (variables && typeof variables === 'object' && !Array.isArray(variables)) {
|
||||||
variables = Object.keys(variables)
|
variables = Object.keys(variables)
|
||||||
.map(function (variableName) {
|
.map(function (variableName) {
|
||||||
return {name: variableName, value: variables[variableName]};
|
return {name: variableName, value: variables[variableName]};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variables) {
|
if (variables) {
|
||||||
variables.forEach(function (variable) {
|
variables.forEach(function (variable) {
|
||||||
el.append(new et.Element('variable', { name: variable.name, value: variable.value }));
|
el.append(new et.Element('variable', { name: variable.name, value: variable.value }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.doc.getroot().append(el);
|
this.doc.getroot().append(el);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Retrives the plugin with the given id or null if not found.
|
* Retrives the plugin with the given id or null if not found.
|
||||||
*
|
*
|
||||||
* This function also returns any plugin's that
|
* This function also returns any plugin's that
|
||||||
* were defined using the legacy <feature> tags.
|
* were defined using the legacy <feature> tags.
|
||||||
* @name getPlugin
|
* @name getPlugin
|
||||||
* @function
|
* @function
|
||||||
* @param {String} id
|
* @param {String} id
|
||||||
* @returns {object} plugin including any variables
|
* @returns {object} plugin including any variables
|
||||||
*/
|
*/
|
||||||
getPlugin: function(id){
|
getPlugin: function(id){
|
||||||
if(!id){
|
if(!id){
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
var pluginElement = this.doc.find('./plugin/[@name="' + id + '"]');
|
var pluginElement = this.doc.find('./plugin/[@name="' + id + '"]');
|
||||||
if (null === pluginElement) {
|
if (null === pluginElement) {
|
||||||
var legacyFeature = this.doc.find('./feature/param[@name="id"][@value="' + id + '"]/..');
|
var legacyFeature = this.doc.find('./feature/param[@name="id"][@value="' + id + '"]/..');
|
||||||
if(legacyFeature){
|
if(legacyFeature){
|
||||||
events.emit('log', 'Found deprecated feature entry for ' + id +' in config.xml.');
|
events.emit('log', 'Found deprecated feature entry for ' + id +' in config.xml.');
|
||||||
return featureToPlugin(legacyFeature);
|
return featureToPlugin(legacyFeature);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
var plugin = {};
|
var plugin = {};
|
||||||
|
|
||||||
plugin.name = pluginElement.attrib.name;
|
plugin.name = pluginElement.attrib.name;
|
||||||
plugin.spec = pluginElement.attrib.spec || pluginElement.attrib.src || pluginElement.attrib.version;
|
plugin.spec = pluginElement.attrib.spec || pluginElement.attrib.src || pluginElement.attrib.version;
|
||||||
plugin.variables = {};
|
plugin.variables = {};
|
||||||
var variableElements = pluginElement.findall('variable');
|
var variableElements = pluginElement.findall('variable');
|
||||||
variableElements.forEach(function(varElement){
|
variableElements.forEach(function(varElement){
|
||||||
var name = varElement.attrib.name;
|
var name = varElement.attrib.name;
|
||||||
var value = varElement.attrib.value;
|
var value = varElement.attrib.value;
|
||||||
if(name){
|
if(name){
|
||||||
plugin.variables[name] = value;
|
plugin.variables[name] = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return plugin;
|
return plugin;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Remove the plugin entry with give name (id).
|
* Remove the plugin entry with give name (id).
|
||||||
*
|
*
|
||||||
* This function also operates on any plugin's that
|
* This function also operates on any plugin's that
|
||||||
* were defined using the legacy <feature> tags.
|
* were defined using the legacy <feature> tags.
|
||||||
* @name removePlugin
|
* @name removePlugin
|
||||||
* @function
|
* @function
|
||||||
* @param id name of the plugin
|
* @param id name of the plugin
|
||||||
*/
|
*/
|
||||||
removePlugin: function(id){
|
removePlugin: function(id){
|
||||||
if(id){
|
if(id){
|
||||||
var plugins = this.doc.findall('./plugin/[@name="' + id + '"]')
|
var plugins = this.doc.findall('./plugin/[@name="' + id + '"]')
|
||||||
.concat(this.doc.findall('./feature/param[@name="id"][@value="' + id + '"]/..'));
|
.concat(this.doc.findall('./feature/param[@name="id"][@value="' + id + '"]/..'));
|
||||||
var children = this.doc.getroot().getchildren();
|
var children = this.doc.getroot().getchildren();
|
||||||
plugins.forEach(function (plugin) {
|
plugins.forEach(function (plugin) {
|
||||||
var idx = children.indexOf(plugin);
|
var idx = children.indexOf(plugin);
|
||||||
if (idx > -1) {
|
if (idx > -1) {
|
||||||
children.splice(idx, 1);
|
children.splice(idx, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Add any element to the root
|
// Add any element to the root
|
||||||
addElement: function(name, attributes) {
|
addElement: function(name, attributes) {
|
||||||
var el = et.Element(name);
|
var el = et.Element(name);
|
||||||
for (var a in attributes) {
|
for (var a in attributes) {
|
||||||
el.attrib[a] = attributes[a];
|
el.attrib[a] = attributes[a];
|
||||||
}
|
}
|
||||||
this.doc.getroot().append(el);
|
this.doc.getroot().append(el);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an engine. Does not check for duplicates.
|
* Adds an engine. Does not check for duplicates.
|
||||||
* @param {String} name the engine name
|
* @param {String} name the engine name
|
||||||
* @param {String} spec engine source location or version (optional)
|
* @param {String} spec engine source location or version (optional)
|
||||||
*/
|
*/
|
||||||
addEngine: function(name, spec){
|
addEngine: function(name, spec){
|
||||||
if(!name) return;
|
if(!name) return;
|
||||||
var el = et.Element('engine');
|
var el = et.Element('engine');
|
||||||
el.attrib.name = name;
|
el.attrib.name = name;
|
||||||
if(spec){
|
if(spec){
|
||||||
el.attrib.spec = spec;
|
el.attrib.spec = spec;
|
||||||
}
|
}
|
||||||
this.doc.getroot().append(el);
|
this.doc.getroot().append(el);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Removes all the engines with given name
|
* Removes all the engines with given name
|
||||||
* @param {String} name the engine name.
|
* @param {String} name the engine name.
|
||||||
*/
|
*/
|
||||||
removeEngine: function(name){
|
removeEngine: function(name){
|
||||||
var engines = this.doc.findall('./engine/[@name="' +name+'"]');
|
var engines = this.doc.findall('./engine/[@name="' +name+'"]');
|
||||||
for(var i=0; i < engines.length; i++){
|
for(var i=0; i < engines.length; i++){
|
||||||
var children = this.doc.getroot().getchildren();
|
var children = this.doc.getroot().getchildren();
|
||||||
var idx = children.indexOf(engines[i]);
|
var idx = children.indexOf(engines[i]);
|
||||||
if(idx > -1){
|
if(idx > -1){
|
||||||
children.splice(idx,1);
|
children.splice(idx,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getEngines: function(){
|
getEngines: function(){
|
||||||
var engines = this.doc.findall('./engine');
|
var engines = this.doc.findall('./engine');
|
||||||
return engines.map(function(engine){
|
return engines.map(function(engine){
|
||||||
var spec = engine.attrib.spec || engine.attrib.version;
|
var spec = engine.attrib.spec || engine.attrib.version;
|
||||||
return {
|
return {
|
||||||
'name': engine.attrib.name,
|
'name': engine.attrib.name,
|
||||||
'spec': spec ? spec : null
|
'spec': spec ? spec : null
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/* Get all the access tags */
|
/* Get all the access tags */
|
||||||
getAccesses: function() {
|
getAccesses: function() {
|
||||||
var accesses = this.doc.findall('./access');
|
var accesses = this.doc.findall('./access');
|
||||||
return accesses.map(function(access){
|
return accesses.map(function(access){
|
||||||
var minimum_tls_version = access.attrib['minimum-tls-version']; /* String */
|
var minimum_tls_version = access.attrib['minimum-tls-version']; /* String */
|
||||||
var requires_forward_secrecy = access.attrib['requires-forward-secrecy']; /* Boolean */
|
var requires_forward_secrecy = access.attrib['requires-forward-secrecy']; /* Boolean */
|
||||||
return {
|
return {
|
||||||
'origin': access.attrib.origin,
|
'origin': access.attrib.origin,
|
||||||
'minimum_tls_version': minimum_tls_version,
|
'minimum_tls_version': minimum_tls_version,
|
||||||
'requires_forward_secrecy' : requires_forward_secrecy
|
'requires_forward_secrecy' : requires_forward_secrecy
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/* Get all the allow-navigation tags */
|
/* Get all the allow-navigation tags */
|
||||||
getAllowNavigations: function() {
|
getAllowNavigations: function() {
|
||||||
var allow_navigations = this.doc.findall('./allow-navigation');
|
var allow_navigations = this.doc.findall('./allow-navigation');
|
||||||
return allow_navigations.map(function(allow_navigation){
|
return allow_navigations.map(function(allow_navigation){
|
||||||
var minimum_tls_version = allow_navigation.attrib['minimum-tls-version']; /* String */
|
var minimum_tls_version = allow_navigation.attrib['minimum-tls-version']; /* String */
|
||||||
var requires_forward_secrecy = allow_navigation.attrib['requires-forward-secrecy']; /* Boolean */
|
var requires_forward_secrecy = allow_navigation.attrib['requires-forward-secrecy']; /* Boolean */
|
||||||
return {
|
return {
|
||||||
'href': allow_navigation.attrib.href,
|
'href': allow_navigation.attrib.href,
|
||||||
'minimum_tls_version': minimum_tls_version,
|
'minimum_tls_version': minimum_tls_version,
|
||||||
'requires_forward_secrecy' : requires_forward_secrecy
|
'requires_forward_secrecy' : requires_forward_secrecy
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
write:function() {
|
write:function() {
|
||||||
fs.writeFileSync(this.path, this.doc.write({indent: 4}), 'utf-8');
|
fs.writeFileSync(this.path, this.doc.write({indent: 4}), 'utf-8');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function featureToPlugin(featureElement) {
|
function featureToPlugin(featureElement) {
|
||||||
var plugin = {};
|
var plugin = {};
|
||||||
plugin.variables = [];
|
plugin.variables = [];
|
||||||
var pluginVersion,
|
var pluginVersion,
|
||||||
pluginSrc;
|
pluginSrc;
|
||||||
|
|
||||||
var nodes = featureElement.findall('param');
|
var nodes = featureElement.findall('param');
|
||||||
nodes.forEach(function (element) {
|
nodes.forEach(function (element) {
|
||||||
var n = element.attrib.name;
|
var n = element.attrib.name;
|
||||||
var v = element.attrib.value;
|
var v = element.attrib.value;
|
||||||
if (n === 'id') {
|
if (n === 'id') {
|
||||||
plugin.name = v;
|
plugin.name = v;
|
||||||
} else if (n === 'version') {
|
} else if (n === 'version') {
|
||||||
pluginVersion = v;
|
pluginVersion = v;
|
||||||
} else if (n === 'url' || n === 'installPath') {
|
} else if (n === 'url' || n === 'installPath') {
|
||||||
pluginSrc = v;
|
pluginSrc = v;
|
||||||
} else {
|
} else {
|
||||||
plugin.variables[n] = v;
|
plugin.variables[n] = v;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var spec = pluginSrc || pluginVersion;
|
var spec = pluginSrc || pluginVersion;
|
||||||
if (spec) {
|
if (spec) {
|
||||||
plugin.spec = spec;
|
plugin.spec = spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
module.exports = ConfigParser;
|
module.exports = ConfigParser;
|
||||||
|
172
node_modules/cordova-common/src/ConfigParser/README.md
generated
vendored
172
node_modules/cordova-common/src/ConfigParser/README.md
generated
vendored
@ -1,86 +1,86 @@
|
|||||||
<!--
|
<!--
|
||||||
#
|
#
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
# or more contributor license agreements. See the NOTICE file
|
# or more contributor license agreements. See the NOTICE file
|
||||||
# distributed with this work for additional information
|
# distributed with this work for additional information
|
||||||
# regarding copyright ownership. The ASF licenses this file
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
# to you under the Apache License, Version 2.0 (the
|
# to you under the Apache License, Version 2.0 (the
|
||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing,
|
# Unless required by applicable law or agreed to in writing,
|
||||||
# software distributed under the License is distributed on an
|
# software distributed under the License is distributed on an
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
# KIND, either express or implied. See the License for the
|
# KIND, either express or implied. See the License for the
|
||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# Cordova-Lib
|
# Cordova-Lib
|
||||||
|
|
||||||
## ConfigParser
|
## ConfigParser
|
||||||
|
|
||||||
wraps a valid cordova config.xml file
|
wraps a valid cordova config.xml file
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
### Include the ConfigParser module in a projet
|
### Include the ConfigParser module in a projet
|
||||||
|
|
||||||
var ConfigParser = require('cordova-lib').configparser;
|
var ConfigParser = require('cordova-lib').configparser;
|
||||||
|
|
||||||
### Create a new ConfigParser
|
### Create a new ConfigParser
|
||||||
|
|
||||||
var config = new ConfigParser('path/to/config/xml/');
|
var config = new ConfigParser('path/to/config/xml/');
|
||||||
|
|
||||||
### Utility Functions
|
### Utility Functions
|
||||||
|
|
||||||
#### packageName(id)
|
#### packageName(id)
|
||||||
returns document root 'id' attribute value
|
returns document root 'id' attribute value
|
||||||
#### Usage
|
#### Usage
|
||||||
|
|
||||||
config.packageName: function(id)
|
config.packageName: function(id)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sets document root element 'id' attribute to @id
|
* sets document root element 'id' attribute to @id
|
||||||
*
|
*
|
||||||
* @id - new id value
|
* @id - new id value
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#### setPackageName(id)
|
#### setPackageName(id)
|
||||||
set document root 'id' attribute to
|
set document root 'id' attribute to
|
||||||
function(id) {
|
function(id) {
|
||||||
this.doc.getroot().attrib['id'] = id;
|
this.doc.getroot().attrib['id'] = id;
|
||||||
},
|
},
|
||||||
|
|
||||||
###
|
###
|
||||||
name: function() {
|
name: function() {
|
||||||
return getNodeTextSafe(this.doc.find('name'));
|
return getNodeTextSafe(this.doc.find('name'));
|
||||||
},
|
},
|
||||||
setName: function(name) {
|
setName: function(name) {
|
||||||
var el = findOrCreate(this.doc, 'name');
|
var el = findOrCreate(this.doc, 'name');
|
||||||
el.text = name;
|
el.text = name;
|
||||||
},
|
},
|
||||||
|
|
||||||
### read the description element
|
### read the description element
|
||||||
|
|
||||||
config.description()
|
config.description()
|
||||||
|
|
||||||
var text = "New and improved description of App"
|
var text = "New and improved description of App"
|
||||||
setDescription(text)
|
setDescription(text)
|
||||||
|
|
||||||
### version management
|
### version management
|
||||||
version()
|
version()
|
||||||
android_versionCode()
|
android_versionCode()
|
||||||
ios_CFBundleVersion()
|
ios_CFBundleVersion()
|
||||||
setVersion()
|
setVersion()
|
||||||
|
|
||||||
### read author element
|
### read author element
|
||||||
|
|
||||||
config.author();
|
config.author();
|
||||||
|
|
||||||
### read preference
|
### read preference
|
||||||
|
|
||||||
config.getPreference(name);
|
config.getPreference(name);
|
||||||
|
182
node_modules/cordova-common/src/CordovaError/CordovaError.js
generated
vendored
182
node_modules/cordova-common/src/CordovaError/CordovaError.js
generated
vendored
@ -1,91 +1,91 @@
|
|||||||
/**
|
/**
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint proto:true */
|
/* jshint proto:true */
|
||||||
|
|
||||||
var EOL = require('os').EOL;
|
var EOL = require('os').EOL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A derived exception class. See usage example in cli.js
|
* A derived exception class. See usage example in cli.js
|
||||||
* Based on:
|
* Based on:
|
||||||
* stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/8460753#8460753
|
* stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/8460753#8460753
|
||||||
* @param {String} message Error message
|
* @param {String} message Error message
|
||||||
* @param {Number} [code=0] Error code
|
* @param {Number} [code=0] Error code
|
||||||
* @param {CordovaExternalToolErrorContext} [context] External tool error context object
|
* @param {CordovaExternalToolErrorContext} [context] External tool error context object
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function CordovaError(message, code, context) {
|
function CordovaError(message, code, context) {
|
||||||
Error.captureStackTrace(this, this.constructor);
|
Error.captureStackTrace(this, this.constructor);
|
||||||
this.name = this.constructor.name;
|
this.name = this.constructor.name;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.code = code || CordovaError.UNKNOWN_ERROR;
|
this.code = code || CordovaError.UNKNOWN_ERROR;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
CordovaError.prototype.__proto__ = Error.prototype;
|
CordovaError.prototype.__proto__ = Error.prototype;
|
||||||
|
|
||||||
// TODO: Extend error codes according the projects specifics
|
// TODO: Extend error codes according the projects specifics
|
||||||
CordovaError.UNKNOWN_ERROR = 0;
|
CordovaError.UNKNOWN_ERROR = 0;
|
||||||
CordovaError.EXTERNAL_TOOL_ERROR = 1;
|
CordovaError.EXTERNAL_TOOL_ERROR = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates instance's error code number into error code name, e.g. 0 -> UNKNOWN_ERROR
|
* Translates instance's error code number into error code name, e.g. 0 -> UNKNOWN_ERROR
|
||||||
* @returns {string} Error code string name
|
* @returns {string} Error code string name
|
||||||
*/
|
*/
|
||||||
CordovaError.prototype.getErrorCodeName = function() {
|
CordovaError.prototype.getErrorCodeName = function() {
|
||||||
for(var key in CordovaError) {
|
for(var key in CordovaError) {
|
||||||
if(CordovaError.hasOwnProperty(key)) {
|
if(CordovaError.hasOwnProperty(key)) {
|
||||||
if(CordovaError[key] === this.code) {
|
if(CordovaError[key] === this.code) {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts CordovaError instance to string representation
|
* Converts CordovaError instance to string representation
|
||||||
* @param {Boolean} [isVerbose] Set up verbose mode. Used to provide more
|
* @param {Boolean} [isVerbose] Set up verbose mode. Used to provide more
|
||||||
* details including information about error code name and context
|
* details including information about error code name and context
|
||||||
* @return {String} Stringified error representation
|
* @return {String} Stringified error representation
|
||||||
*/
|
*/
|
||||||
CordovaError.prototype.toString = function(isVerbose) {
|
CordovaError.prototype.toString = function(isVerbose) {
|
||||||
var message = '', codePrefix = '';
|
var message = '', codePrefix = '';
|
||||||
|
|
||||||
if(this.code !== CordovaError.UNKNOWN_ERROR) {
|
if(this.code !== CordovaError.UNKNOWN_ERROR) {
|
||||||
codePrefix = 'code: ' + this.code + (isVerbose ? (' (' + this.getErrorCodeName() + ')') : '') + ' ';
|
codePrefix = 'code: ' + this.code + (isVerbose ? (' (' + this.getErrorCodeName() + ')') : '') + ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.code === CordovaError.EXTERNAL_TOOL_ERROR) {
|
if(this.code === CordovaError.EXTERNAL_TOOL_ERROR) {
|
||||||
if(typeof this.context !== 'undefined') {
|
if(typeof this.context !== 'undefined') {
|
||||||
if(isVerbose) {
|
if(isVerbose) {
|
||||||
message = codePrefix + EOL + this.context.toString(isVerbose) + '\n failed with an error: ' +
|
message = codePrefix + EOL + this.context.toString(isVerbose) + '\n failed with an error: ' +
|
||||||
this.message + EOL + 'Stack trace: ' + this.stack;
|
this.message + EOL + 'Stack trace: ' + this.stack;
|
||||||
} else {
|
} else {
|
||||||
message = codePrefix + '\'' + this.context.toString(isVerbose) + '\' ' + this.message;
|
message = codePrefix + '\'' + this.context.toString(isVerbose) + '\' ' + this.message;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message = 'External tool failed with an error: ' + this.message;
|
message = 'External tool failed with an error: ' + this.message;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message = isVerbose ? codePrefix + this.stack : codePrefix + this.message;
|
message = isVerbose ? codePrefix + this.stack : codePrefix + this.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = CordovaError;
|
module.exports = CordovaError;
|
||||||
|
96
node_modules/cordova-common/src/CordovaError/CordovaExternalToolErrorContext.js
generated
vendored
96
node_modules/cordova-common/src/CordovaError/CordovaExternalToolErrorContext.js
generated
vendored
@ -1,48 +1,48 @@
|
|||||||
/**
|
/**
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint proto:true */
|
/* jshint proto:true */
|
||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} cmd Command full path
|
* @param {String} cmd Command full path
|
||||||
* @param {String[]} args Command args
|
* @param {String[]} args Command args
|
||||||
* @param {String} [cwd] Command working directory
|
* @param {String} [cwd] Command working directory
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function CordovaExternalToolErrorContext(cmd, args, cwd) {
|
function CordovaExternalToolErrorContext(cmd, args, cwd) {
|
||||||
this.cmd = cmd;
|
this.cmd = cmd;
|
||||||
// Helper field for readability
|
// Helper field for readability
|
||||||
this.cmdShortName = path.basename(cmd);
|
this.cmdShortName = path.basename(cmd);
|
||||||
this.args = args;
|
this.args = args;
|
||||||
this.cwd = cwd;
|
this.cwd = cwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
CordovaExternalToolErrorContext.prototype.toString = function(isVerbose) {
|
CordovaExternalToolErrorContext.prototype.toString = function(isVerbose) {
|
||||||
if(isVerbose) {
|
if(isVerbose) {
|
||||||
return 'External tool \'' + this.cmdShortName + '\'' +
|
return 'External tool \'' + this.cmdShortName + '\'' +
|
||||||
'\nCommand full path: ' + this.cmd + '\nCommand args: ' + this.args +
|
'\nCommand full path: ' + this.cmd + '\nCommand args: ' + this.args +
|
||||||
(typeof this.cwd !== 'undefined' ? '\nCommand cwd: ' + this.cwd : '');
|
(typeof this.cwd !== 'undefined' ? '\nCommand cwd: ' + this.cwd : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.cmdShortName;
|
return this.cmdShortName;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = CordovaExternalToolErrorContext;
|
module.exports = CordovaExternalToolErrorContext;
|
||||||
|
310
node_modules/cordova-common/src/PlatformJson.js
generated
vendored
310
node_modules/cordova-common/src/PlatformJson.js
generated
vendored
@ -1,155 +1,155 @@
|
|||||||
/*
|
/*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/* jshint sub:true */
|
/* jshint sub:true */
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var shelljs = require('shelljs');
|
var shelljs = require('shelljs');
|
||||||
var mungeutil = require('./ConfigChanges/munge-util');
|
var mungeutil = require('./ConfigChanges/munge-util');
|
||||||
var pluginMappernto = require('cordova-registry-mapper').newToOld;
|
var pluginMappernto = require('cordova-registry-mapper').newToOld;
|
||||||
var pluginMapperotn = require('cordova-registry-mapper').oldToNew;
|
var pluginMapperotn = require('cordova-registry-mapper').oldToNew;
|
||||||
|
|
||||||
function PlatformJson(filePath, platform, root) {
|
function PlatformJson(filePath, platform, root) {
|
||||||
this.filePath = filePath;
|
this.filePath = filePath;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.root = fix_munge(root || {});
|
this.root = fix_munge(root || {});
|
||||||
}
|
}
|
||||||
|
|
||||||
PlatformJson.load = function(plugins_dir, platform) {
|
PlatformJson.load = function(plugins_dir, platform) {
|
||||||
var filePath = path.join(plugins_dir, platform + '.json');
|
var filePath = path.join(plugins_dir, platform + '.json');
|
||||||
var root = null;
|
var root = null;
|
||||||
if (fs.existsSync(filePath)) {
|
if (fs.existsSync(filePath)) {
|
||||||
root = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
root = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
||||||
}
|
}
|
||||||
return new PlatformJson(filePath, platform, root);
|
return new PlatformJson(filePath, platform, root);
|
||||||
};
|
};
|
||||||
|
|
||||||
PlatformJson.prototype.save = function() {
|
PlatformJson.prototype.save = function() {
|
||||||
shelljs.mkdir('-p', path.dirname(this.filePath));
|
shelljs.mkdir('-p', path.dirname(this.filePath));
|
||||||
fs.writeFileSync(this.filePath, JSON.stringify(this.root, null, 4), 'utf-8');
|
fs.writeFileSync(this.filePath, JSON.stringify(this.root, null, 4), 'utf-8');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the specified plugin is installed as a top-level (not as
|
* Indicates whether the specified plugin is installed as a top-level (not as
|
||||||
* dependency to others)
|
* dependency to others)
|
||||||
* @method function
|
* @method function
|
||||||
* @param {String} pluginId A plugin id to check for.
|
* @param {String} pluginId A plugin id to check for.
|
||||||
* @return {Boolean} true if plugin installed as top-level, otherwise false.
|
* @return {Boolean} true if plugin installed as top-level, otherwise false.
|
||||||
*/
|
*/
|
||||||
PlatformJson.prototype.isPluginTopLevel = function(pluginId) {
|
PlatformJson.prototype.isPluginTopLevel = function(pluginId) {
|
||||||
var installedPlugins = this.root.installed_plugins;
|
var installedPlugins = this.root.installed_plugins;
|
||||||
return installedPlugins[pluginId] ||
|
return installedPlugins[pluginId] ||
|
||||||
installedPlugins[pluginMappernto[pluginId]] ||
|
installedPlugins[pluginMappernto[pluginId]] ||
|
||||||
installedPlugins[pluginMapperotn[pluginId]];
|
installedPlugins[pluginMapperotn[pluginId]];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the specified plugin is installed as a dependency to other
|
* Indicates whether the specified plugin is installed as a dependency to other
|
||||||
* plugin.
|
* plugin.
|
||||||
* @method function
|
* @method function
|
||||||
* @param {String} pluginId A plugin id to check for.
|
* @param {String} pluginId A plugin id to check for.
|
||||||
* @return {Boolean} true if plugin installed as a dependency, otherwise false.
|
* @return {Boolean} true if plugin installed as a dependency, otherwise false.
|
||||||
*/
|
*/
|
||||||
PlatformJson.prototype.isPluginDependent = function(pluginId) {
|
PlatformJson.prototype.isPluginDependent = function(pluginId) {
|
||||||
var dependentPlugins = this.root.dependent_plugins;
|
var dependentPlugins = this.root.dependent_plugins;
|
||||||
return dependentPlugins[pluginId] ||
|
return dependentPlugins[pluginId] ||
|
||||||
dependentPlugins[pluginMappernto[pluginId]] ||
|
dependentPlugins[pluginMappernto[pluginId]] ||
|
||||||
dependentPlugins[pluginMapperotn[pluginId]];
|
dependentPlugins[pluginMapperotn[pluginId]];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether plugin is installed either as top-level or as dependency.
|
* Indicates whether plugin is installed either as top-level or as dependency.
|
||||||
* @method function
|
* @method function
|
||||||
* @param {String} pluginId A plugin id to check for.
|
* @param {String} pluginId A plugin id to check for.
|
||||||
* @return {Boolean} true if plugin installed, otherwise false.
|
* @return {Boolean} true if plugin installed, otherwise false.
|
||||||
*/
|
*/
|
||||||
PlatformJson.prototype.isPluginInstalled = function(pluginId) {
|
PlatformJson.prototype.isPluginInstalled = function(pluginId) {
|
||||||
return this.isPluginTopLevel(pluginId) ||
|
return this.isPluginTopLevel(pluginId) ||
|
||||||
this.isPluginDependent(pluginId);
|
this.isPluginDependent(pluginId);
|
||||||
};
|
};
|
||||||
|
|
||||||
PlatformJson.prototype.addPlugin = function(pluginId, variables, isTopLevel) {
|
PlatformJson.prototype.addPlugin = function(pluginId, variables, isTopLevel) {
|
||||||
var pluginsList = isTopLevel ?
|
var pluginsList = isTopLevel ?
|
||||||
this.root.installed_plugins :
|
this.root.installed_plugins :
|
||||||
this.root.dependent_plugins;
|
this.root.dependent_plugins;
|
||||||
|
|
||||||
pluginsList[pluginId] = variables;
|
pluginsList[pluginId] = variables;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
PlatformJson.prototype.removePlugin = function(pluginId, isTopLevel) {
|
PlatformJson.prototype.removePlugin = function(pluginId, isTopLevel) {
|
||||||
var pluginsList = isTopLevel ?
|
var pluginsList = isTopLevel ?
|
||||||
this.root.installed_plugins :
|
this.root.installed_plugins :
|
||||||
this.root.dependent_plugins;
|
this.root.dependent_plugins;
|
||||||
|
|
||||||
delete pluginsList[pluginId];
|
delete pluginsList[pluginId];
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
PlatformJson.prototype.addInstalledPluginToPrepareQueue = function(pluginDirName, vars, is_top_level) {
|
PlatformJson.prototype.addInstalledPluginToPrepareQueue = function(pluginDirName, vars, is_top_level) {
|
||||||
this.root.prepare_queue.installed.push({'plugin':pluginDirName, 'vars':vars, 'topLevel':is_top_level});
|
this.root.prepare_queue.installed.push({'plugin':pluginDirName, 'vars':vars, 'topLevel':is_top_level});
|
||||||
};
|
};
|
||||||
|
|
||||||
PlatformJson.prototype.addUninstalledPluginToPrepareQueue = function(pluginId, is_top_level) {
|
PlatformJson.prototype.addUninstalledPluginToPrepareQueue = function(pluginId, is_top_level) {
|
||||||
this.root.prepare_queue.uninstalled.push({'plugin':pluginId, 'id':pluginId, 'topLevel':is_top_level});
|
this.root.prepare_queue.uninstalled.push({'plugin':pluginId, 'id':pluginId, 'topLevel':is_top_level});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves plugin, specified by id to top-level plugins. If plugin is top-level
|
* Moves plugin, specified by id to top-level plugins. If plugin is top-level
|
||||||
* already, then does nothing.
|
* already, then does nothing.
|
||||||
* @method function
|
* @method function
|
||||||
* @param {String} pluginId A plugin id to make top-level.
|
* @param {String} pluginId A plugin id to make top-level.
|
||||||
* @return {PlatformJson} PlatformJson instance.
|
* @return {PlatformJson} PlatformJson instance.
|
||||||
*/
|
*/
|
||||||
PlatformJson.prototype.makeTopLevel = function(pluginId) {
|
PlatformJson.prototype.makeTopLevel = function(pluginId) {
|
||||||
var plugin = this.root.dependent_plugins[pluginId];
|
var plugin = this.root.dependent_plugins[pluginId];
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
delete this.root.dependent_plugins[pluginId];
|
delete this.root.dependent_plugins[pluginId];
|
||||||
this.root.installed_plugins[pluginId] = plugin;
|
this.root.installed_plugins[pluginId] = plugin;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
// convert a munge from the old format ([file][parent][xml] = count) to the current one
|
// convert a munge from the old format ([file][parent][xml] = count) to the current one
|
||||||
function fix_munge(root) {
|
function fix_munge(root) {
|
||||||
root.prepare_queue = root.prepare_queue || {installed:[], uninstalled:[]};
|
root.prepare_queue = root.prepare_queue || {installed:[], uninstalled:[]};
|
||||||
root.config_munge = root.config_munge || {files: {}};
|
root.config_munge = root.config_munge || {files: {}};
|
||||||
root.installed_plugins = root.installed_plugins || {};
|
root.installed_plugins = root.installed_plugins || {};
|
||||||
root.dependent_plugins = root.dependent_plugins || {};
|
root.dependent_plugins = root.dependent_plugins || {};
|
||||||
|
|
||||||
var munge = root.config_munge;
|
var munge = root.config_munge;
|
||||||
if (!munge.files) {
|
if (!munge.files) {
|
||||||
var new_munge = { files: {} };
|
var new_munge = { files: {} };
|
||||||
for (var file in munge) {
|
for (var file in munge) {
|
||||||
for (var selector in munge[file]) {
|
for (var selector in munge[file]) {
|
||||||
for (var xml_child in munge[file][selector]) {
|
for (var xml_child in munge[file][selector]) {
|
||||||
var val = parseInt(munge[file][selector][xml_child]);
|
var val = parseInt(munge[file][selector][xml_child]);
|
||||||
for (var i = 0; i < val; i++) {
|
for (var i = 0; i < val; i++) {
|
||||||
mungeutil.deep_add(new_munge, [file, selector, { xml: xml_child, count: val }]);
|
mungeutil.deep_add(new_munge, [file, selector, { xml: xml_child, count: val }]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.config_munge = new_munge;
|
root.config_munge = new_munge;
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PlatformJson;
|
module.exports = PlatformJson;
|
||||||
|
|
||||||
|
832
node_modules/cordova-common/src/PluginInfo/PluginInfo.js
generated
vendored
832
node_modules/cordova-common/src/PluginInfo/PluginInfo.js
generated
vendored
@ -1,416 +1,416 @@
|
|||||||
/**
|
/**
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint sub:true, laxcomma:true, laxbreak:true */
|
/* jshint sub:true, laxcomma:true, laxbreak:true */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A class for holidng the information currently stored in plugin.xml
|
A class for holidng the information currently stored in plugin.xml
|
||||||
It should also be able to answer questions like whether the plugin
|
It should also be able to answer questions like whether the plugin
|
||||||
is compatible with a given engine version.
|
is compatible with a given engine version.
|
||||||
|
|
||||||
TODO (kamrik): refactor this to not use sync functions and return promises.
|
TODO (kamrik): refactor this to not use sync functions and return promises.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
, fs = require('fs')
|
, fs = require('fs')
|
||||||
, xml_helpers = require('../util/xml-helpers')
|
, xml_helpers = require('../util/xml-helpers')
|
||||||
, CordovaError = require('../CordovaError/CordovaError')
|
, CordovaError = require('../CordovaError/CordovaError')
|
||||||
;
|
;
|
||||||
|
|
||||||
function PluginInfo(dirname) {
|
function PluginInfo(dirname) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
// Defined inside the constructor to avoid the "this" binding problems.
|
// Defined inside the constructor to avoid the "this" binding problems.
|
||||||
|
|
||||||
// <preference> tag
|
// <preference> tag
|
||||||
// Example: <preference name="API_KEY" />
|
// Example: <preference name="API_KEY" />
|
||||||
// Used to require a variable to be specified via --variable when installing the plugin.
|
// Used to require a variable to be specified via --variable when installing the plugin.
|
||||||
self.getPreferences = getPreferences;
|
self.getPreferences = getPreferences;
|
||||||
function getPreferences(platform) {
|
function getPreferences(platform) {
|
||||||
var arprefs = _getTags(self._et, 'preference', platform, _parsePreference);
|
var arprefs = _getTags(self._et, 'preference', platform, _parsePreference);
|
||||||
|
|
||||||
var prefs= {};
|
var prefs= {};
|
||||||
for(var i in arprefs)
|
for(var i in arprefs)
|
||||||
{
|
{
|
||||||
var pref=arprefs[i];
|
var pref=arprefs[i];
|
||||||
prefs[pref.preference]=pref.default;
|
prefs[pref.preference]=pref.default;
|
||||||
}
|
}
|
||||||
// returns { key : default | null}
|
// returns { key : default | null}
|
||||||
return prefs;
|
return prefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _parsePreference(prefTag) {
|
function _parsePreference(prefTag) {
|
||||||
var name = prefTag.attrib.name.toUpperCase();
|
var name = prefTag.attrib.name.toUpperCase();
|
||||||
var def = prefTag.attrib.default || null;
|
var def = prefTag.attrib.default || null;
|
||||||
return {preference: name, default: def};
|
return {preference: name, default: def};
|
||||||
}
|
}
|
||||||
|
|
||||||
// <asset>
|
// <asset>
|
||||||
self.getAssets = getAssets;
|
self.getAssets = getAssets;
|
||||||
function getAssets(platform) {
|
function getAssets(platform) {
|
||||||
var assets = _getTags(self._et, 'asset', platform, _parseAsset);
|
var assets = _getTags(self._et, 'asset', platform, _parseAsset);
|
||||||
return assets;
|
return assets;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _parseAsset(tag) {
|
function _parseAsset(tag) {
|
||||||
var src = tag.attrib.src;
|
var src = tag.attrib.src;
|
||||||
var target = tag.attrib.target;
|
var target = tag.attrib.target;
|
||||||
|
|
||||||
if ( !src || !target) {
|
if ( !src || !target) {
|
||||||
var msg =
|
var msg =
|
||||||
'Malformed <asset> tag. Both "src" and "target" attributes'
|
'Malformed <asset> tag. Both "src" and "target" attributes'
|
||||||
+ 'must be specified in\n'
|
+ 'must be specified in\n'
|
||||||
+ self.filepath
|
+ self.filepath
|
||||||
;
|
;
|
||||||
throw new Error(msg);
|
throw new Error(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
var asset = {
|
var asset = {
|
||||||
itemType: 'asset',
|
itemType: 'asset',
|
||||||
src: src,
|
src: src,
|
||||||
target: target
|
target: target
|
||||||
};
|
};
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// <dependency>
|
// <dependency>
|
||||||
// Example:
|
// Example:
|
||||||
// <dependency id="com.plugin.id"
|
// <dependency id="com.plugin.id"
|
||||||
// url="https://github.com/myuser/someplugin"
|
// url="https://github.com/myuser/someplugin"
|
||||||
// commit="428931ada3891801"
|
// commit="428931ada3891801"
|
||||||
// subdir="some/path/here" />
|
// subdir="some/path/here" />
|
||||||
self.getDependencies = getDependencies;
|
self.getDependencies = getDependencies;
|
||||||
function getDependencies(platform) {
|
function getDependencies(platform) {
|
||||||
var deps = _getTags(
|
var deps = _getTags(
|
||||||
self._et,
|
self._et,
|
||||||
'dependency',
|
'dependency',
|
||||||
platform,
|
platform,
|
||||||
_parseDependency
|
_parseDependency
|
||||||
);
|
);
|
||||||
return deps;
|
return deps;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _parseDependency(tag) {
|
function _parseDependency(tag) {
|
||||||
var dep =
|
var dep =
|
||||||
{ id : tag.attrib.id
|
{ id : tag.attrib.id
|
||||||
, url : tag.attrib.url || ''
|
, url : tag.attrib.url || ''
|
||||||
, subdir : tag.attrib.subdir || ''
|
, subdir : tag.attrib.subdir || ''
|
||||||
, commit : tag.attrib.commit
|
, commit : tag.attrib.commit
|
||||||
};
|
};
|
||||||
|
|
||||||
dep.git_ref = dep.commit;
|
dep.git_ref = dep.commit;
|
||||||
|
|
||||||
if ( !dep.id ) {
|
if ( !dep.id ) {
|
||||||
var msg =
|
var msg =
|
||||||
'<dependency> tag is missing id attribute in '
|
'<dependency> tag is missing id attribute in '
|
||||||
+ self.filepath
|
+ self.filepath
|
||||||
;
|
;
|
||||||
throw new CordovaError(msg);
|
throw new CordovaError(msg);
|
||||||
}
|
}
|
||||||
return dep;
|
return dep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// <config-file> tag
|
// <config-file> tag
|
||||||
self.getConfigFiles = getConfigFiles;
|
self.getConfigFiles = getConfigFiles;
|
||||||
function getConfigFiles(platform) {
|
function getConfigFiles(platform) {
|
||||||
var configFiles = _getTags(self._et, 'config-file', platform, _parseConfigFile);
|
var configFiles = _getTags(self._et, 'config-file', platform, _parseConfigFile);
|
||||||
return configFiles;
|
return configFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _parseConfigFile(tag) {
|
function _parseConfigFile(tag) {
|
||||||
var configFile =
|
var configFile =
|
||||||
{ target : tag.attrib['target']
|
{ target : tag.attrib['target']
|
||||||
, parent : tag.attrib['parent']
|
, parent : tag.attrib['parent']
|
||||||
, after : tag.attrib['after']
|
, after : tag.attrib['after']
|
||||||
, xmls : tag.getchildren()
|
, xmls : tag.getchildren()
|
||||||
// To support demuxing via versions
|
// To support demuxing via versions
|
||||||
, versions : tag.attrib['versions']
|
, versions : tag.attrib['versions']
|
||||||
, deviceTarget: tag.attrib['device-target']
|
, deviceTarget: tag.attrib['device-target']
|
||||||
};
|
};
|
||||||
return configFile;
|
return configFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <info> tags, both global and within a <platform>
|
// <info> tags, both global and within a <platform>
|
||||||
// TODO (kamrik): Do we ever use <info> under <platform>? Example wanted.
|
// TODO (kamrik): Do we ever use <info> under <platform>? Example wanted.
|
||||||
self.getInfo = getInfo;
|
self.getInfo = getInfo;
|
||||||
function getInfo(platform) {
|
function getInfo(platform) {
|
||||||
var infos = _getTags(
|
var infos = _getTags(
|
||||||
self._et,
|
self._et,
|
||||||
'info',
|
'info',
|
||||||
platform,
|
platform,
|
||||||
function(elem) { return elem.text; }
|
function(elem) { return elem.text; }
|
||||||
);
|
);
|
||||||
// Filter out any undefined or empty strings.
|
// Filter out any undefined or empty strings.
|
||||||
infos = infos.filter(Boolean);
|
infos = infos.filter(Boolean);
|
||||||
return infos;
|
return infos;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <source-file>
|
// <source-file>
|
||||||
// Examples:
|
// Examples:
|
||||||
// <source-file src="src/ios/someLib.a" framework="true" />
|
// <source-file src="src/ios/someLib.a" framework="true" />
|
||||||
// <source-file src="src/ios/someLib.a" compiler-flags="-fno-objc-arc" />
|
// <source-file src="src/ios/someLib.a" compiler-flags="-fno-objc-arc" />
|
||||||
self.getSourceFiles = getSourceFiles;
|
self.getSourceFiles = getSourceFiles;
|
||||||
function getSourceFiles(platform) {
|
function getSourceFiles(platform) {
|
||||||
var sourceFiles = _getTagsInPlatform(self._et, 'source-file', platform, _parseSourceFile);
|
var sourceFiles = _getTagsInPlatform(self._et, 'source-file', platform, _parseSourceFile);
|
||||||
return sourceFiles;
|
return sourceFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _parseSourceFile(tag) {
|
function _parseSourceFile(tag) {
|
||||||
return {
|
return {
|
||||||
itemType: 'source-file',
|
itemType: 'source-file',
|
||||||
src: tag.attrib.src,
|
src: tag.attrib.src,
|
||||||
framework: isStrTrue(tag.attrib.framework),
|
framework: isStrTrue(tag.attrib.framework),
|
||||||
weak: isStrTrue(tag.attrib.weak),
|
weak: isStrTrue(tag.attrib.weak),
|
||||||
compilerFlags: tag.attrib['compiler-flags'],
|
compilerFlags: tag.attrib['compiler-flags'],
|
||||||
targetDir: tag.attrib['target-dir']
|
targetDir: tag.attrib['target-dir']
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// <header-file>
|
// <header-file>
|
||||||
// Example:
|
// Example:
|
||||||
// <header-file src="CDVFoo.h" />
|
// <header-file src="CDVFoo.h" />
|
||||||
self.getHeaderFiles = getHeaderFiles;
|
self.getHeaderFiles = getHeaderFiles;
|
||||||
function getHeaderFiles(platform) {
|
function getHeaderFiles(platform) {
|
||||||
var headerFiles = _getTagsInPlatform(self._et, 'header-file', platform, function(tag) {
|
var headerFiles = _getTagsInPlatform(self._et, 'header-file', platform, function(tag) {
|
||||||
return {
|
return {
|
||||||
itemType: 'header-file',
|
itemType: 'header-file',
|
||||||
src: tag.attrib.src,
|
src: tag.attrib.src,
|
||||||
targetDir: tag.attrib['target-dir']
|
targetDir: tag.attrib['target-dir']
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return headerFiles;
|
return headerFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <resource-file>
|
// <resource-file>
|
||||||
// Example:
|
// Example:
|
||||||
// <resource-file src="FooPluginStrings.xml" target="res/values/FooPluginStrings.xml" device-target="win" arch="x86" versions=">=8.1" />
|
// <resource-file src="FooPluginStrings.xml" target="res/values/FooPluginStrings.xml" device-target="win" arch="x86" versions=">=8.1" />
|
||||||
self.getResourceFiles = getResourceFiles;
|
self.getResourceFiles = getResourceFiles;
|
||||||
function getResourceFiles(platform) {
|
function getResourceFiles(platform) {
|
||||||
var resourceFiles = _getTagsInPlatform(self._et, 'resource-file', platform, function(tag) {
|
var resourceFiles = _getTagsInPlatform(self._et, 'resource-file', platform, function(tag) {
|
||||||
return {
|
return {
|
||||||
itemType: 'resource-file',
|
itemType: 'resource-file',
|
||||||
src: tag.attrib.src,
|
src: tag.attrib.src,
|
||||||
target: tag.attrib.target,
|
target: tag.attrib.target,
|
||||||
versions: tag.attrib.versions,
|
versions: tag.attrib.versions,
|
||||||
deviceTarget: tag.attrib['device-target'],
|
deviceTarget: tag.attrib['device-target'],
|
||||||
arch: tag.attrib.arch
|
arch: tag.attrib.arch
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return resourceFiles;
|
return resourceFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <lib-file>
|
// <lib-file>
|
||||||
// Example:
|
// Example:
|
||||||
// <lib-file src="src/BlackBerry10/native/device/libfoo.so" arch="device" />
|
// <lib-file src="src/BlackBerry10/native/device/libfoo.so" arch="device" />
|
||||||
self.getLibFiles = getLibFiles;
|
self.getLibFiles = getLibFiles;
|
||||||
function getLibFiles(platform) {
|
function getLibFiles(platform) {
|
||||||
var libFiles = _getTagsInPlatform(self._et, 'lib-file', platform, function(tag) {
|
var libFiles = _getTagsInPlatform(self._et, 'lib-file', platform, function(tag) {
|
||||||
return {
|
return {
|
||||||
itemType: 'lib-file',
|
itemType: 'lib-file',
|
||||||
src: tag.attrib.src,
|
src: tag.attrib.src,
|
||||||
arch: tag.attrib.arch,
|
arch: tag.attrib.arch,
|
||||||
Include: tag.attrib.Include,
|
Include: tag.attrib.Include,
|
||||||
versions: tag.attrib.versions,
|
versions: tag.attrib.versions,
|
||||||
deviceTarget: tag.attrib['device-target'] || tag.attrib.target
|
deviceTarget: tag.attrib['device-target'] || tag.attrib.target
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
return libFiles;
|
return libFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <hook>
|
// <hook>
|
||||||
// Example:
|
// Example:
|
||||||
// <hook type="before_build" src="scripts/beforeBuild.js" />
|
// <hook type="before_build" src="scripts/beforeBuild.js" />
|
||||||
self.getHookScripts = getHookScripts;
|
self.getHookScripts = getHookScripts;
|
||||||
function getHookScripts(hook, platforms) {
|
function getHookScripts(hook, platforms) {
|
||||||
var scriptElements = self._et.findall('./hook');
|
var scriptElements = self._et.findall('./hook');
|
||||||
|
|
||||||
if(platforms) {
|
if(platforms) {
|
||||||
platforms.forEach(function (platform) {
|
platforms.forEach(function (platform) {
|
||||||
scriptElements = scriptElements.concat(self._et.findall('./platform[@name="' + platform + '"]/hook'));
|
scriptElements = scriptElements.concat(self._et.findall('./platform[@name="' + platform + '"]/hook'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterScriptByHookType(el) {
|
function filterScriptByHookType(el) {
|
||||||
return el.attrib.src && el.attrib.type && el.attrib.type.toLowerCase() === hook;
|
return el.attrib.src && el.attrib.type && el.attrib.type.toLowerCase() === hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
return scriptElements.filter(filterScriptByHookType);
|
return scriptElements.filter(filterScriptByHookType);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getJsModules = getJsModules;
|
self.getJsModules = getJsModules;
|
||||||
function getJsModules(platform) {
|
function getJsModules(platform) {
|
||||||
var modules = _getTags(self._et, 'js-module', platform, _parseJsModule);
|
var modules = _getTags(self._et, 'js-module', platform, _parseJsModule);
|
||||||
return modules;
|
return modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _parseJsModule(tag) {
|
function _parseJsModule(tag) {
|
||||||
var ret = {
|
var ret = {
|
||||||
itemType: 'js-module',
|
itemType: 'js-module',
|
||||||
name: tag.attrib.name,
|
name: tag.attrib.name,
|
||||||
src: tag.attrib.src,
|
src: tag.attrib.src,
|
||||||
clobbers: tag.findall('clobbers').map(function(tag) { return { target: tag.attrib.target }; }),
|
clobbers: tag.findall('clobbers').map(function(tag) { return { target: tag.attrib.target }; }),
|
||||||
merges: tag.findall('merges').map(function(tag) { return { target: tag.attrib.target }; }),
|
merges: tag.findall('merges').map(function(tag) { return { target: tag.attrib.target }; }),
|
||||||
runs: tag.findall('runs').length > 0
|
runs: tag.findall('runs').length > 0
|
||||||
};
|
};
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.getEngines = function() {
|
self.getEngines = function() {
|
||||||
return self._et.findall('engines/engine').map(function(n) {
|
return self._et.findall('engines/engine').map(function(n) {
|
||||||
return {
|
return {
|
||||||
name: n.attrib.name,
|
name: n.attrib.name,
|
||||||
version: n.attrib.version,
|
version: n.attrib.version,
|
||||||
platform: n.attrib.platform,
|
platform: n.attrib.platform,
|
||||||
scriptSrc: n.attrib.scriptSrc
|
scriptSrc: n.attrib.scriptSrc
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getPlatforms = function() {
|
self.getPlatforms = function() {
|
||||||
return self._et.findall('platform').map(function(n) {
|
return self._et.findall('platform').map(function(n) {
|
||||||
return { name: n.attrib.name };
|
return { name: n.attrib.name };
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getPlatformsArray = function() {
|
self.getPlatformsArray = function() {
|
||||||
return self._et.findall('platform').map(function(n) {
|
return self._et.findall('platform').map(function(n) {
|
||||||
return n.attrib.name;
|
return n.attrib.name;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
self.getFrameworks = function(platform) {
|
self.getFrameworks = function(platform) {
|
||||||
return _getTags(self._et, 'framework', platform, function(el) {
|
return _getTags(self._et, 'framework', platform, function(el) {
|
||||||
var ret = {
|
var ret = {
|
||||||
itemType: 'framework',
|
itemType: 'framework',
|
||||||
type: el.attrib.type,
|
type: el.attrib.type,
|
||||||
parent: el.attrib.parent,
|
parent: el.attrib.parent,
|
||||||
custom: isStrTrue(el.attrib.custom),
|
custom: isStrTrue(el.attrib.custom),
|
||||||
src: el.attrib.src,
|
src: el.attrib.src,
|
||||||
weak: isStrTrue(el.attrib.weak),
|
weak: isStrTrue(el.attrib.weak),
|
||||||
versions: el.attrib.versions,
|
versions: el.attrib.versions,
|
||||||
targetDir: el.attrib['target-dir'],
|
targetDir: el.attrib['target-dir'],
|
||||||
deviceTarget: el.attrib['device-target'] || el.attrib.target,
|
deviceTarget: el.attrib['device-target'] || el.attrib.target,
|
||||||
arch: el.attrib.arch
|
arch: el.attrib.arch
|
||||||
};
|
};
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getFilesAndFrameworks = getFilesAndFrameworks;
|
self.getFilesAndFrameworks = getFilesAndFrameworks;
|
||||||
function getFilesAndFrameworks(platform) {
|
function getFilesAndFrameworks(platform) {
|
||||||
// Please avoid changing the order of the calls below, files will be
|
// Please avoid changing the order of the calls below, files will be
|
||||||
// installed in this order.
|
// installed in this order.
|
||||||
var items = [].concat(
|
var items = [].concat(
|
||||||
self.getSourceFiles(platform),
|
self.getSourceFiles(platform),
|
||||||
self.getHeaderFiles(platform),
|
self.getHeaderFiles(platform),
|
||||||
self.getResourceFiles(platform),
|
self.getResourceFiles(platform),
|
||||||
self.getFrameworks(platform),
|
self.getFrameworks(platform),
|
||||||
self.getLibFiles(platform)
|
self.getLibFiles(platform)
|
||||||
);
|
);
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
///// End of PluginInfo methods /////
|
///// End of PluginInfo methods /////
|
||||||
|
|
||||||
|
|
||||||
///// PluginInfo Constructor logic /////
|
///// PluginInfo Constructor logic /////
|
||||||
self.filepath = path.join(dirname, 'plugin.xml');
|
self.filepath = path.join(dirname, 'plugin.xml');
|
||||||
if (!fs.existsSync(self.filepath)) {
|
if (!fs.existsSync(self.filepath)) {
|
||||||
throw new CordovaError('Cannot find plugin.xml for plugin \'' + path.basename(dirname) + '\'. Please try adding it again.');
|
throw new CordovaError('Cannot find plugin.xml for plugin \'' + path.basename(dirname) + '\'. Please try adding it again.');
|
||||||
}
|
}
|
||||||
|
|
||||||
self.dir = dirname;
|
self.dir = dirname;
|
||||||
var et = self._et = xml_helpers.parseElementtreeSync(self.filepath);
|
var et = self._et = xml_helpers.parseElementtreeSync(self.filepath);
|
||||||
var pelem = et.getroot();
|
var pelem = et.getroot();
|
||||||
self.id = pelem.attrib.id;
|
self.id = pelem.attrib.id;
|
||||||
self.version = pelem.attrib.version;
|
self.version = pelem.attrib.version;
|
||||||
|
|
||||||
// Optional fields
|
// Optional fields
|
||||||
self.name = pelem.findtext('name');
|
self.name = pelem.findtext('name');
|
||||||
self.description = pelem.findtext('description');
|
self.description = pelem.findtext('description');
|
||||||
self.license = pelem.findtext('license');
|
self.license = pelem.findtext('license');
|
||||||
self.repo = pelem.findtext('repo');
|
self.repo = pelem.findtext('repo');
|
||||||
self.issue = pelem.findtext('issue');
|
self.issue = pelem.findtext('issue');
|
||||||
self.keywords = pelem.findtext('keywords');
|
self.keywords = pelem.findtext('keywords');
|
||||||
self.info = pelem.findtext('info');
|
self.info = pelem.findtext('info');
|
||||||
if (self.keywords) {
|
if (self.keywords) {
|
||||||
self.keywords = self.keywords.split(',').map( function(s) { return s.trim(); } );
|
self.keywords = self.keywords.split(',').map( function(s) { return s.trim(); } );
|
||||||
}
|
}
|
||||||
self.getKeywordsAndPlatforms = function () {
|
self.getKeywordsAndPlatforms = function () {
|
||||||
var ret = self.keywords || [];
|
var ret = self.keywords || [];
|
||||||
return ret.concat('ecosystem:cordova').concat(addCordova(self.getPlatformsArray()));
|
return ret.concat('ecosystem:cordova').concat(addCordova(self.getPlatformsArray()));
|
||||||
};
|
};
|
||||||
} // End of PluginInfo constructor.
|
} // End of PluginInfo constructor.
|
||||||
|
|
||||||
// Helper function used to prefix every element of an array with cordova-
|
// Helper function used to prefix every element of an array with cordova-
|
||||||
// Useful when we want to modify platforms to be cordova-platform
|
// Useful when we want to modify platforms to be cordova-platform
|
||||||
function addCordova(someArray) {
|
function addCordova(someArray) {
|
||||||
var newArray = someArray.map(function(element) {
|
var newArray = someArray.map(function(element) {
|
||||||
return 'cordova-' + element;
|
return 'cordova-' + element;
|
||||||
});
|
});
|
||||||
return newArray;
|
return newArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function used by most of the getSomething methods of PluginInfo.
|
// Helper function used by most of the getSomething methods of PluginInfo.
|
||||||
// Get all elements of a given name. Both in root and in platform sections
|
// Get all elements of a given name. Both in root and in platform sections
|
||||||
// for the given platform. If transform is given and is a function, it is
|
// for the given platform. If transform is given and is a function, it is
|
||||||
// applied to each element.
|
// applied to each element.
|
||||||
function _getTags(pelem, tag, platform, transform) {
|
function _getTags(pelem, tag, platform, transform) {
|
||||||
var platformTag = pelem.find('./platform[@name="' + platform + '"]');
|
var platformTag = pelem.find('./platform[@name="' + platform + '"]');
|
||||||
if (platform == 'windows' && !platformTag) {
|
if (platform == 'windows' && !platformTag) {
|
||||||
platformTag = pelem.find('platform[@name="' + 'windows8' + '"]');
|
platformTag = pelem.find('platform[@name="' + 'windows8' + '"]');
|
||||||
}
|
}
|
||||||
var tagsInRoot = pelem.findall(tag);
|
var tagsInRoot = pelem.findall(tag);
|
||||||
tagsInRoot = tagsInRoot || [];
|
tagsInRoot = tagsInRoot || [];
|
||||||
var tagsInPlatform = platformTag ? platformTag.findall(tag) : [];
|
var tagsInPlatform = platformTag ? platformTag.findall(tag) : [];
|
||||||
var tags = tagsInRoot.concat(tagsInPlatform);
|
var tags = tagsInRoot.concat(tagsInPlatform);
|
||||||
if ( typeof transform === 'function' ) {
|
if ( typeof transform === 'function' ) {
|
||||||
tags = tags.map(transform);
|
tags = tags.map(transform);
|
||||||
}
|
}
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same as _getTags() but only looks inside a platfrom section.
|
// Same as _getTags() but only looks inside a platfrom section.
|
||||||
function _getTagsInPlatform(pelem, tag, platform, transform) {
|
function _getTagsInPlatform(pelem, tag, platform, transform) {
|
||||||
var platformTag = pelem.find('./platform[@name="' + platform + '"]');
|
var platformTag = pelem.find('./platform[@name="' + platform + '"]');
|
||||||
if (platform == 'windows' && !platformTag) {
|
if (platform == 'windows' && !platformTag) {
|
||||||
platformTag = pelem.find('platform[@name="' + 'windows8' + '"]');
|
platformTag = pelem.find('platform[@name="' + 'windows8' + '"]');
|
||||||
}
|
}
|
||||||
var tags = platformTag ? platformTag.findall(tag) : [];
|
var tags = platformTag ? platformTag.findall(tag) : [];
|
||||||
if ( typeof transform === 'function' ) {
|
if ( typeof transform === 'function' ) {
|
||||||
tags = tags.map(transform);
|
tags = tags.map(transform);
|
||||||
}
|
}
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if x is a string 'true'.
|
// Check if x is a string 'true'.
|
||||||
function isStrTrue(x) {
|
function isStrTrue(x) {
|
||||||
return String(x).toLowerCase() == 'true';
|
return String(x).toLowerCase() == 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PluginInfo;
|
module.exports = PluginInfo;
|
||||||
// Backwards compat:
|
// Backwards compat:
|
||||||
PluginInfo.PluginInfo = PluginInfo;
|
PluginInfo.PluginInfo = PluginInfo;
|
||||||
PluginInfo.loadPluginsDir = function(dir) {
|
PluginInfo.loadPluginsDir = function(dir) {
|
||||||
var PluginInfoProvider = require('./PluginInfoProvider');
|
var PluginInfoProvider = require('./PluginInfoProvider');
|
||||||
return new PluginInfoProvider().getAllWithinSearchPath(dir);
|
return new PluginInfoProvider().getAllWithinSearchPath(dir);
|
||||||
};
|
};
|
||||||
|
164
node_modules/cordova-common/src/PluginInfo/PluginInfoProvider.js
generated
vendored
164
node_modules/cordova-common/src/PluginInfo/PluginInfoProvider.js
generated
vendored
@ -1,82 +1,82 @@
|
|||||||
/**
|
/**
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint sub:true, laxcomma:true, laxbreak:true */
|
/* jshint sub:true, laxcomma:true, laxbreak:true */
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var PluginInfo = require('./PluginInfo');
|
var PluginInfo = require('./PluginInfo');
|
||||||
var events = require('../events');
|
var events = require('../events');
|
||||||
|
|
||||||
function PluginInfoProvider() {
|
function PluginInfoProvider() {
|
||||||
this._cache = {};
|
this._cache = {};
|
||||||
this._getAllCache = {};
|
this._getAllCache = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInfoProvider.prototype.get = function(dirName) {
|
PluginInfoProvider.prototype.get = function(dirName) {
|
||||||
var absPath = path.resolve(dirName);
|
var absPath = path.resolve(dirName);
|
||||||
if (!this._cache[absPath]) {
|
if (!this._cache[absPath]) {
|
||||||
this._cache[absPath] = new PluginInfo(dirName);
|
this._cache[absPath] = new PluginInfo(dirName);
|
||||||
}
|
}
|
||||||
return this._cache[absPath];
|
return this._cache[absPath];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Normally you don't need to put() entries, but it's used
|
// Normally you don't need to put() entries, but it's used
|
||||||
// when copying plugins, and in unit tests.
|
// when copying plugins, and in unit tests.
|
||||||
PluginInfoProvider.prototype.put = function(pluginInfo) {
|
PluginInfoProvider.prototype.put = function(pluginInfo) {
|
||||||
var absPath = path.resolve(pluginInfo.dir);
|
var absPath = path.resolve(pluginInfo.dir);
|
||||||
this._cache[absPath] = pluginInfo;
|
this._cache[absPath] = pluginInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used for plugin search path processing.
|
// Used for plugin search path processing.
|
||||||
// Given a dir containing multiple plugins, create a PluginInfo object for
|
// Given a dir containing multiple plugins, create a PluginInfo object for
|
||||||
// each of them and return as array.
|
// each of them and return as array.
|
||||||
// Should load them all in parallel and return a promise, but not yet.
|
// Should load them all in parallel and return a promise, but not yet.
|
||||||
PluginInfoProvider.prototype.getAllWithinSearchPath = function(dirName) {
|
PluginInfoProvider.prototype.getAllWithinSearchPath = function(dirName) {
|
||||||
var absPath = path.resolve(dirName);
|
var absPath = path.resolve(dirName);
|
||||||
if (!this._getAllCache[absPath]) {
|
if (!this._getAllCache[absPath]) {
|
||||||
this._getAllCache[absPath] = getAllHelper(absPath, this);
|
this._getAllCache[absPath] = getAllHelper(absPath, this);
|
||||||
}
|
}
|
||||||
return this._getAllCache[absPath];
|
return this._getAllCache[absPath];
|
||||||
};
|
};
|
||||||
|
|
||||||
function getAllHelper(absPath, provider) {
|
function getAllHelper(absPath, provider) {
|
||||||
if (!fs.existsSync(absPath)){
|
if (!fs.existsSync(absPath)){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
// If dir itself is a plugin, return it in an array with one element.
|
// If dir itself is a plugin, return it in an array with one element.
|
||||||
if (fs.existsSync(path.join(absPath, 'plugin.xml'))) {
|
if (fs.existsSync(path.join(absPath, 'plugin.xml'))) {
|
||||||
return [provider.get(absPath)];
|
return [provider.get(absPath)];
|
||||||
}
|
}
|
||||||
var subdirs = fs.readdirSync(absPath);
|
var subdirs = fs.readdirSync(absPath);
|
||||||
var plugins = [];
|
var plugins = [];
|
||||||
subdirs.forEach(function(subdir) {
|
subdirs.forEach(function(subdir) {
|
||||||
var d = path.join(absPath, subdir);
|
var d = path.join(absPath, subdir);
|
||||||
if (fs.existsSync(path.join(d, 'plugin.xml'))) {
|
if (fs.existsSync(path.join(d, 'plugin.xml'))) {
|
||||||
try {
|
try {
|
||||||
plugins.push(provider.get(d));
|
plugins.push(provider.get(d));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
events.emit('warn', 'Error parsing ' + path.join(d, 'plugin.xml.\n' + e.stack));
|
events.emit('warn', 'Error parsing ' + path.join(d, 'plugin.xml.\n' + e.stack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return plugins;
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PluginInfoProvider;
|
module.exports = PluginInfoProvider;
|
||||||
|
38
node_modules/cordova-common/src/events.js
generated
vendored
38
node_modules/cordova-common/src/events.js
generated
vendored
@ -1,19 +1,19 @@
|
|||||||
/**
|
/**
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
module.exports = new (require('events').EventEmitter)();
|
module.exports = new (require('events').EventEmitter)();
|
||||||
|
308
node_modules/cordova-common/src/superspawn.js
generated
vendored
308
node_modules/cordova-common/src/superspawn.js
generated
vendored
@ -1,154 +1,154 @@
|
|||||||
/**
|
/**
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
distributed with this work for additional information
|
distributed with this work for additional information
|
||||||
regarding copyright ownership. The ASF licenses this file
|
regarding copyright ownership. The ASF licenses this file
|
||||||
to you under the Apache License, Version 2.0 (the
|
to you under the Apache License, Version 2.0 (the
|
||||||
"License"); you may not use this file except in compliance
|
"License"); you may not use this file except in compliance
|
||||||
with the License. You may obtain a copy of the License at
|
with the License. You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
Unless required by applicable law or agreed to in writing,
|
||||||
software distributed under the License is distributed on an
|
software distributed under the License is distributed on an
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
KIND, either express or implied. See the License for the
|
KIND, either express or implied. See the License for the
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var child_process = require('child_process');
|
var child_process = require('child_process');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var Q = require('q');
|
var Q = require('q');
|
||||||
var shell = require('shelljs');
|
var shell = require('shelljs');
|
||||||
var events = require('./events');
|
var events = require('./events');
|
||||||
var iswin32 = process.platform == 'win32';
|
var iswin32 = process.platform == 'win32';
|
||||||
|
|
||||||
// On Windows, spawn() for batch files requires absolute path & having the extension.
|
// On Windows, spawn() for batch files requires absolute path & having the extension.
|
||||||
function resolveWindowsExe(cmd) {
|
function resolveWindowsExe(cmd) {
|
||||||
var winExtensions = ['.exe', '.cmd', '.bat', '.js', '.vbs'];
|
var winExtensions = ['.exe', '.cmd', '.bat', '.js', '.vbs'];
|
||||||
function isValidExe(c) {
|
function isValidExe(c) {
|
||||||
return winExtensions.indexOf(path.extname(c)) !== -1 && fs.existsSync(c);
|
return winExtensions.indexOf(path.extname(c)) !== -1 && fs.existsSync(c);
|
||||||
}
|
}
|
||||||
if (isValidExe(cmd)) {
|
if (isValidExe(cmd)) {
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
cmd = shell.which(cmd) || cmd;
|
cmd = shell.which(cmd) || cmd;
|
||||||
if (!isValidExe(cmd)) {
|
if (!isValidExe(cmd)) {
|
||||||
winExtensions.some(function(ext) {
|
winExtensions.some(function(ext) {
|
||||||
if (fs.existsSync(cmd + ext)) {
|
if (fs.existsSync(cmd + ext)) {
|
||||||
cmd = cmd + ext;
|
cmd = cmd + ext;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
function maybeQuote(a) {
|
function maybeQuote(a) {
|
||||||
if (/^[^"].*[ &].*[^"]/.test(a)) return '"' + a + '"';
|
if (/^[^"].*[ &].*[^"]/.test(a)) return '"' + a + '"';
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
// opts:
|
// opts:
|
||||||
// printCommand: Whether to log the command (default: false)
|
// printCommand: Whether to log the command (default: false)
|
||||||
// stdio: 'default' is to capture output and returning it as a string to success (same as exec)
|
// stdio: 'default' is to capture output and returning it as a string to success (same as exec)
|
||||||
// 'ignore' means don't bother capturing it
|
// 'ignore' means don't bother capturing it
|
||||||
// 'inherit' means pipe the input & output. This is required for anything that prompts.
|
// 'inherit' means pipe the input & output. This is required for anything that prompts.
|
||||||
// env: Map of extra environment variables.
|
// env: Map of extra environment variables.
|
||||||
// cwd: Working directory for the command.
|
// cwd: Working directory for the command.
|
||||||
// chmod: If truthy, will attempt to set the execute bit before executing on non-Windows platforms.
|
// chmod: If truthy, will attempt to set the execute bit before executing on non-Windows platforms.
|
||||||
// Returns a promise that succeeds only for return code = 0.
|
// Returns a promise that succeeds only for return code = 0.
|
||||||
exports.spawn = function(cmd, args, opts) {
|
exports.spawn = function(cmd, args, opts) {
|
||||||
args = args || [];
|
args = args || [];
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
var spawnOpts = {};
|
var spawnOpts = {};
|
||||||
var d = Q.defer();
|
var d = Q.defer();
|
||||||
|
|
||||||
if (iswin32) {
|
if (iswin32) {
|
||||||
cmd = resolveWindowsExe(cmd);
|
cmd = resolveWindowsExe(cmd);
|
||||||
// If we couldn't find the file, likely we'll end up failing,
|
// If we couldn't find the file, likely we'll end up failing,
|
||||||
// but for things like "del", cmd will do the trick.
|
// but for things like "del", cmd will do the trick.
|
||||||
if (path.extname(cmd) != '.exe') {
|
if (path.extname(cmd) != '.exe') {
|
||||||
var cmdArgs = '"' + [cmd].concat(args).map(maybeQuote).join(' ') + '"';
|
var cmdArgs = '"' + [cmd].concat(args).map(maybeQuote).join(' ') + '"';
|
||||||
// We need to use /s to ensure that spaces are parsed properly with cmd spawned content
|
// We need to use /s to ensure that spaces are parsed properly with cmd spawned content
|
||||||
args = [['/s', '/c', cmdArgs].join(' ')];
|
args = [['/s', '/c', cmdArgs].join(' ')];
|
||||||
cmd = 'cmd';
|
cmd = 'cmd';
|
||||||
spawnOpts.windowsVerbatimArguments = true;
|
spawnOpts.windowsVerbatimArguments = true;
|
||||||
} else if (!fs.existsSync(cmd)) {
|
} else if (!fs.existsSync(cmd)) {
|
||||||
// We need to use /s to ensure that spaces are parsed properly with cmd spawned content
|
// We need to use /s to ensure that spaces are parsed properly with cmd spawned content
|
||||||
args = ['/s', '/c', cmd].concat(args).map(maybeQuote);
|
args = ['/s', '/c', cmd].concat(args).map(maybeQuote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.stdio == 'ignore') {
|
if (opts.stdio == 'ignore') {
|
||||||
spawnOpts.stdio = 'ignore';
|
spawnOpts.stdio = 'ignore';
|
||||||
} else if (opts.stdio == 'inherit') {
|
} else if (opts.stdio == 'inherit') {
|
||||||
spawnOpts.stdio = 'inherit';
|
spawnOpts.stdio = 'inherit';
|
||||||
}
|
}
|
||||||
if (opts.cwd) {
|
if (opts.cwd) {
|
||||||
spawnOpts.cwd = opts.cwd;
|
spawnOpts.cwd = opts.cwd;
|
||||||
}
|
}
|
||||||
if (opts.env) {
|
if (opts.env) {
|
||||||
spawnOpts.env = _.extend(_.extend({}, process.env), opts.env);
|
spawnOpts.env = _.extend(_.extend({}, process.env), opts.env);
|
||||||
}
|
}
|
||||||
if (opts.chmod && !iswin32) {
|
if (opts.chmod && !iswin32) {
|
||||||
try {
|
try {
|
||||||
// This fails when module is installed in a system directory (e.g. via sudo npm install)
|
// This fails when module is installed in a system directory (e.g. via sudo npm install)
|
||||||
fs.chmodSync(cmd, '755');
|
fs.chmodSync(cmd, '755');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// If the perms weren't set right, then this will come as an error upon execution.
|
// If the perms weren't set right, then this will come as an error upon execution.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
events.emit(opts.printCommand ? 'log' : 'verbose', 'Running command: ' + maybeQuote(cmd) + ' ' + args.map(maybeQuote).join(' '));
|
events.emit(opts.printCommand ? 'log' : 'verbose', 'Running command: ' + maybeQuote(cmd) + ' ' + args.map(maybeQuote).join(' '));
|
||||||
|
|
||||||
var child = child_process.spawn(cmd, args, spawnOpts);
|
var child = child_process.spawn(cmd, args, spawnOpts);
|
||||||
var capturedOut = '';
|
var capturedOut = '';
|
||||||
var capturedErr = '';
|
var capturedErr = '';
|
||||||
|
|
||||||
if (child.stdout) {
|
if (child.stdout) {
|
||||||
child.stdout.setEncoding('utf8');
|
child.stdout.setEncoding('utf8');
|
||||||
child.stdout.on('data', function(data) {
|
child.stdout.on('data', function(data) {
|
||||||
capturedOut += data;
|
capturedOut += data;
|
||||||
});
|
});
|
||||||
|
|
||||||
child.stderr.setEncoding('utf8');
|
child.stderr.setEncoding('utf8');
|
||||||
child.stderr.on('data', function(data) {
|
child.stderr.on('data', function(data) {
|
||||||
capturedErr += data;
|
capturedErr += data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
child.on('close', whenDone);
|
child.on('close', whenDone);
|
||||||
child.on('error', whenDone);
|
child.on('error', whenDone);
|
||||||
function whenDone(arg) {
|
function whenDone(arg) {
|
||||||
child.removeListener('close', whenDone);
|
child.removeListener('close', whenDone);
|
||||||
child.removeListener('error', whenDone);
|
child.removeListener('error', whenDone);
|
||||||
var code = typeof arg == 'number' ? arg : arg && arg.code;
|
var code = typeof arg == 'number' ? arg : arg && arg.code;
|
||||||
|
|
||||||
events.emit('verbose', 'Command finished with error code ' + code + ': ' + cmd + ' ' + args);
|
events.emit('verbose', 'Command finished with error code ' + code + ': ' + cmd + ' ' + args);
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
d.resolve(capturedOut.trim());
|
d.resolve(capturedOut.trim());
|
||||||
} else {
|
} else {
|
||||||
var errMsg = cmd + ': Command failed with exit code ' + code;
|
var errMsg = cmd + ': Command failed with exit code ' + code;
|
||||||
if (capturedErr) {
|
if (capturedErr) {
|
||||||
errMsg += ' Error output:\n' + capturedErr.trim();
|
errMsg += ' Error output:\n' + capturedErr.trim();
|
||||||
}
|
}
|
||||||
var err = new Error(errMsg);
|
var err = new Error(errMsg);
|
||||||
err.code = code;
|
err.code = code;
|
||||||
d.reject(err);
|
d.reject(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return d.promise;
|
return d.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.maybeSpawn = function(cmd, args, opts) {
|
exports.maybeSpawn = function(cmd, args, opts) {
|
||||||
if (fs.existsSync(cmd)) {
|
if (fs.existsSync(cmd)) {
|
||||||
return exports.spawn(cmd, args, opts);
|
return exports.spawn(cmd, args, opts);
|
||||||
}
|
}
|
||||||
return Q(null);
|
return Q(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
202
node_modules/cordova-common/src/util/plist-helpers.js
generated
vendored
202
node_modules/cordova-common/src/util/plist-helpers.js
generated
vendored
@ -1,101 +1,101 @@
|
|||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2013 Brett Rudd
|
* Copyright 2013 Brett Rudd
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// contains PLIST utility functions
|
// contains PLIST utility functions
|
||||||
var __ = require('underscore');
|
var __ = require('underscore');
|
||||||
var plist = require('plist');
|
var plist = require('plist');
|
||||||
|
|
||||||
// adds node to doc at selector
|
// adds node to doc at selector
|
||||||
module.exports.graftPLIST = graftPLIST;
|
module.exports.graftPLIST = graftPLIST;
|
||||||
function graftPLIST(doc, xml, selector) {
|
function graftPLIST(doc, xml, selector) {
|
||||||
var obj = plist.parse('<plist>'+xml+'</plist>');
|
var obj = plist.parse('<plist>'+xml+'</plist>');
|
||||||
|
|
||||||
var node = doc[selector];
|
var node = doc[selector];
|
||||||
if (node && Array.isArray(node) && Array.isArray(obj)){
|
if (node && Array.isArray(node) && Array.isArray(obj)){
|
||||||
node = node.concat(obj);
|
node = node.concat(obj);
|
||||||
for (var i =0;i<node.length; i++){
|
for (var i =0;i<node.length; i++){
|
||||||
for (var j=i+1; j<node.length; ++j) {
|
for (var j=i+1; j<node.length; ++j) {
|
||||||
if (nodeEqual(node[i], node[j]))
|
if (nodeEqual(node[i], node[j]))
|
||||||
node.splice(j--,1);
|
node.splice(j--,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doc[selector] = node;
|
doc[selector] = node;
|
||||||
} else {
|
} else {
|
||||||
//plist uses objects for <dict>. If we have two dicts we merge them instead of
|
//plist uses objects for <dict>. If we have two dicts we merge them instead of
|
||||||
// overriding the old one. See CB-6472
|
// overriding the old one. See CB-6472
|
||||||
if (node && __.isObject(node) && __.isObject(obj) && !__.isDate(node) && !__.isDate(obj)){//arrays checked above
|
if (node && __.isObject(node) && __.isObject(obj) && !__.isDate(node) && !__.isDate(obj)){//arrays checked above
|
||||||
__.extend(obj,node);
|
__.extend(obj,node);
|
||||||
}
|
}
|
||||||
doc[selector] = obj;
|
doc[selector] = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// removes node from doc at selector
|
// removes node from doc at selector
|
||||||
module.exports.prunePLIST = prunePLIST;
|
module.exports.prunePLIST = prunePLIST;
|
||||||
function prunePLIST(doc, xml, selector) {
|
function prunePLIST(doc, xml, selector) {
|
||||||
var obj = plist.parse('<plist>'+xml+'</plist>');
|
var obj = plist.parse('<plist>'+xml+'</plist>');
|
||||||
|
|
||||||
pruneOBJECT(doc, selector, obj);
|
pruneOBJECT(doc, selector, obj);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pruneOBJECT(doc, selector, fragment) {
|
function pruneOBJECT(doc, selector, fragment) {
|
||||||
if (Array.isArray(fragment) && Array.isArray(doc[selector])) {
|
if (Array.isArray(fragment) && Array.isArray(doc[selector])) {
|
||||||
var empty = true;
|
var empty = true;
|
||||||
for (var i in fragment) {
|
for (var i in fragment) {
|
||||||
for (var j in doc[selector]) {
|
for (var j in doc[selector]) {
|
||||||
empty = pruneOBJECT(doc[selector], j, fragment[i]) && empty;
|
empty = pruneOBJECT(doc[selector], j, fragment[i]) && empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty)
|
if (empty)
|
||||||
{
|
{
|
||||||
delete doc[selector];
|
delete doc[selector];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nodeEqual(doc[selector], fragment)) {
|
else if (nodeEqual(doc[selector], fragment)) {
|
||||||
delete doc[selector];
|
delete doc[selector];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodeEqual(node1, node2) {
|
function nodeEqual(node1, node2) {
|
||||||
if (typeof node1 != typeof node2)
|
if (typeof node1 != typeof node2)
|
||||||
return false;
|
return false;
|
||||||
else if (typeof node1 == 'string') {
|
else if (typeof node1 == 'string') {
|
||||||
node2 = escapeRE(node2).replace(new RegExp('\\$[a-zA-Z0-9-_]+','gm'),'(.*?)');
|
node2 = escapeRE(node2).replace(new RegExp('\\$[a-zA-Z0-9-_]+','gm'),'(.*?)');
|
||||||
return new RegExp('^' + node2 + '$').test(node1);
|
return new RegExp('^' + node2 + '$').test(node1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (var key in node2) {
|
for (var key in node2) {
|
||||||
if (!nodeEqual(node1[key], node2[key])) return false;
|
if (!nodeEqual(node1[key], node2[key])) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// escape string for use in regex
|
// escape string for use in regex
|
||||||
function escapeRE(str) {
|
function escapeRE(str) {
|
||||||
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '$&');
|
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '$&');
|
||||||
}
|
}
|
||||||
|
532
node_modules/cordova-common/src/util/xml-helpers.js
generated
vendored
532
node_modules/cordova-common/src/util/xml-helpers.js
generated
vendored
@ -1,266 +1,266 @@
|
|||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2013 Anis Kadri
|
* Copyright 2013 Anis Kadri
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing,
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* software distributed under the License is distributed on an
|
* software distributed under the License is distributed on an
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* jshint sub:true, laxcomma:true */
|
/* jshint sub:true, laxcomma:true */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* contains XML utility functions, some of which are specific to elementtree
|
* contains XML utility functions, some of which are specific to elementtree
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
, path = require('path')
|
, path = require('path')
|
||||||
, _ = require('underscore')
|
, _ = require('underscore')
|
||||||
, et = require('elementtree')
|
, et = require('elementtree')
|
||||||
;
|
;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// compare two et.XML nodes, see if they match
|
// compare two et.XML nodes, see if they match
|
||||||
// compares tagName, text, attributes and children (recursively)
|
// compares tagName, text, attributes and children (recursively)
|
||||||
equalNodes: function(one, two) {
|
equalNodes: function(one, two) {
|
||||||
if (one.tag != two.tag) {
|
if (one.tag != two.tag) {
|
||||||
return false;
|
return false;
|
||||||
} else if (one.text.trim() != two.text.trim()) {
|
} else if (one.text.trim() != two.text.trim()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (one._children.length != two._children.length) {
|
} else if (one._children.length != two._children.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var oneAttribKeys = Object.keys(one.attrib),
|
var oneAttribKeys = Object.keys(one.attrib),
|
||||||
twoAttribKeys = Object.keys(two.attrib),
|
twoAttribKeys = Object.keys(two.attrib),
|
||||||
i = 0, attribName;
|
i = 0, attribName;
|
||||||
|
|
||||||
if (oneAttribKeys.length != twoAttribKeys.length) {
|
if (oneAttribKeys.length != twoAttribKeys.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i; i < oneAttribKeys.length; i++) {
|
for (i; i < oneAttribKeys.length; i++) {
|
||||||
attribName = oneAttribKeys[i];
|
attribName = oneAttribKeys[i];
|
||||||
|
|
||||||
if (one.attrib[attribName] != two.attrib[attribName]) {
|
if (one.attrib[attribName] != two.attrib[attribName]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i; i < one._children.length; i++) {
|
for (i; i < one._children.length; i++) {
|
||||||
if (!module.exports.equalNodes(one._children[i], two._children[i])) {
|
if (!module.exports.equalNodes(one._children[i], two._children[i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
// adds node to doc at selector, creating parent if it doesn't exist
|
// adds node to doc at selector, creating parent if it doesn't exist
|
||||||
graftXML: function(doc, nodes, selector, after) {
|
graftXML: function(doc, nodes, selector, after) {
|
||||||
var parent = resolveParent(doc, selector);
|
var parent = resolveParent(doc, selector);
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
//Try to create the parent recursively if necessary
|
//Try to create the parent recursively if necessary
|
||||||
try {
|
try {
|
||||||
var parentToCreate = et.XML('<' + path.basename(selector) + '>'),
|
var parentToCreate = et.XML('<' + path.basename(selector) + '>'),
|
||||||
parentSelector = path.dirname(selector);
|
parentSelector = path.dirname(selector);
|
||||||
|
|
||||||
this.graftXML(doc, [parentToCreate], parentSelector);
|
this.graftXML(doc, [parentToCreate], parentSelector);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
parent = resolveParent(doc, selector);
|
parent = resolveParent(doc, selector);
|
||||||
if (!parent) return false;
|
if (!parent) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes.forEach(function (node) {
|
nodes.forEach(function (node) {
|
||||||
// check if child is unique first
|
// check if child is unique first
|
||||||
if (uniqueChild(node, parent)) {
|
if (uniqueChild(node, parent)) {
|
||||||
var children = parent.getchildren();
|
var children = parent.getchildren();
|
||||||
var insertIdx = after ? findInsertIdx(children, after) : children.length;
|
var insertIdx = after ? findInsertIdx(children, after) : children.length;
|
||||||
|
|
||||||
//TODO: replace with parent.insert after the bug in ElementTree is fixed
|
//TODO: replace with parent.insert after the bug in ElementTree is fixed
|
||||||
parent.getchildren().splice(insertIdx, 0, node);
|
parent.getchildren().splice(insertIdx, 0, node);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
// removes node from doc at selector
|
// removes node from doc at selector
|
||||||
pruneXML: function(doc, nodes, selector) {
|
pruneXML: function(doc, nodes, selector) {
|
||||||
var parent = resolveParent(doc, selector);
|
var parent = resolveParent(doc, selector);
|
||||||
if (!parent) return false;
|
if (!parent) return false;
|
||||||
|
|
||||||
nodes.forEach(function (node) {
|
nodes.forEach(function (node) {
|
||||||
var matchingKid = null;
|
var matchingKid = null;
|
||||||
if ((matchingKid = findChild(node, parent)) !== null) {
|
if ((matchingKid = findChild(node, parent)) !== null) {
|
||||||
// stupid elementtree takes an index argument it doesn't use
|
// stupid elementtree takes an index argument it doesn't use
|
||||||
// and does not conform to the python lib
|
// and does not conform to the python lib
|
||||||
parent.remove(matchingKid);
|
parent.remove(matchingKid);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
parseElementtreeSync: function (filename) {
|
parseElementtreeSync: function (filename) {
|
||||||
var contents = fs.readFileSync(filename, 'utf-8');
|
var contents = fs.readFileSync(filename, 'utf-8');
|
||||||
if(contents) {
|
if(contents) {
|
||||||
//Windows is the BOM. Skip the Byte Order Mark.
|
//Windows is the BOM. Skip the Byte Order Mark.
|
||||||
contents = contents.substring(contents.indexOf('<'));
|
contents = contents.substring(contents.indexOf('<'));
|
||||||
}
|
}
|
||||||
return new et.ElementTree(et.XML(contents));
|
return new et.ElementTree(et.XML(contents));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function findChild(node, parent) {
|
function findChild(node, parent) {
|
||||||
var matchingKids = parent.findall(node.tag)
|
var matchingKids = parent.findall(node.tag)
|
||||||
, i, j;
|
, i, j;
|
||||||
|
|
||||||
for (i = 0, j = matchingKids.length ; i < j ; i++) {
|
for (i = 0, j = matchingKids.length ; i < j ; i++) {
|
||||||
if (module.exports.equalNodes(node, matchingKids[i])) {
|
if (module.exports.equalNodes(node, matchingKids[i])) {
|
||||||
return matchingKids[i];
|
return matchingKids[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function uniqueChild(node, parent) {
|
function uniqueChild(node, parent) {
|
||||||
var matchingKids = parent.findall(node.tag)
|
var matchingKids = parent.findall(node.tag)
|
||||||
, i = 0;
|
, i = 0;
|
||||||
|
|
||||||
if (matchingKids.length === 0) {
|
if (matchingKids.length === 0) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
for (i; i < matchingKids.length; i++) {
|
for (i; i < matchingKids.length; i++) {
|
||||||
if (module.exports.equalNodes(node, matchingKids[i])) {
|
if (module.exports.equalNodes(node, matchingKids[i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ROOT = /^\/([^\/]*)/,
|
var ROOT = /^\/([^\/]*)/,
|
||||||
ABSOLUTE = /^\/([^\/]*)\/(.*)/;
|
ABSOLUTE = /^\/([^\/]*)\/(.*)/;
|
||||||
|
|
||||||
function resolveParent(doc, selector) {
|
function resolveParent(doc, selector) {
|
||||||
var parent, tagName, subSelector;
|
var parent, tagName, subSelector;
|
||||||
|
|
||||||
// handle absolute selector (which elementtree doesn't like)
|
// handle absolute selector (which elementtree doesn't like)
|
||||||
if (ROOT.test(selector)) {
|
if (ROOT.test(selector)) {
|
||||||
tagName = selector.match(ROOT)[1];
|
tagName = selector.match(ROOT)[1];
|
||||||
// test for wildcard "any-tag" root selector
|
// test for wildcard "any-tag" root selector
|
||||||
if (tagName == '*' || tagName === doc._root.tag) {
|
if (tagName == '*' || tagName === doc._root.tag) {
|
||||||
parent = doc._root;
|
parent = doc._root;
|
||||||
|
|
||||||
// could be an absolute path, but not selecting the root
|
// could be an absolute path, but not selecting the root
|
||||||
if (ABSOLUTE.test(selector)) {
|
if (ABSOLUTE.test(selector)) {
|
||||||
subSelector = selector.match(ABSOLUTE)[2];
|
subSelector = selector.match(ABSOLUTE)[2];
|
||||||
parent = parent.find(subSelector);
|
parent = parent.find(subSelector);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
parent = doc.find(selector);
|
parent = doc.find(selector);
|
||||||
}
|
}
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the index at which to insert an entry. After is a ;-separated priority list
|
// Find the index at which to insert an entry. After is a ;-separated priority list
|
||||||
// of tags after which the insertion should be made. E.g. If we need to
|
// of tags after which the insertion should be made. E.g. If we need to
|
||||||
// insert an element C, and the rule is that the order of children has to be
|
// insert an element C, and the rule is that the order of children has to be
|
||||||
// As, Bs, Cs. After will be equal to "C;B;A".
|
// As, Bs, Cs. After will be equal to "C;B;A".
|
||||||
function findInsertIdx(children, after) {
|
function findInsertIdx(children, after) {
|
||||||
var childrenTags = children.map(function(child) { return child.tag; });
|
var childrenTags = children.map(function(child) { return child.tag; });
|
||||||
var afters = after.split(';');
|
var afters = after.split(';');
|
||||||
var afterIndexes = afters.map(function(current) { return childrenTags.lastIndexOf(current); });
|
var afterIndexes = afters.map(function(current) { return childrenTags.lastIndexOf(current); });
|
||||||
var foundIndex = _.find(afterIndexes, function(index) { return index != -1; });
|
var foundIndex = _.find(afterIndexes, function(index) { return index != -1; });
|
||||||
|
|
||||||
//add to the beginning if no matching nodes are found
|
//add to the beginning if no matching nodes are found
|
||||||
return typeof foundIndex === 'undefined' ? 0 : foundIndex+1;
|
return typeof foundIndex === 'undefined' ? 0 : foundIndex+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var BLACKLIST = ['platform', 'feature','plugin','engine'];
|
var BLACKLIST = ['platform', 'feature','plugin','engine'];
|
||||||
var SINGLETONS = ['content', 'author'];
|
var SINGLETONS = ['content', 'author'];
|
||||||
function mergeXml(src, dest, platform, clobber) {
|
function mergeXml(src, dest, platform, clobber) {
|
||||||
// Do nothing for blacklisted tags.
|
// Do nothing for blacklisted tags.
|
||||||
if (BLACKLIST.indexOf(src.tag) != -1) return;
|
if (BLACKLIST.indexOf(src.tag) != -1) return;
|
||||||
|
|
||||||
//Handle attributes
|
//Handle attributes
|
||||||
Object.getOwnPropertyNames(src.attrib).forEach(function (attribute) {
|
Object.getOwnPropertyNames(src.attrib).forEach(function (attribute) {
|
||||||
if (clobber || !dest.attrib[attribute]) {
|
if (clobber || !dest.attrib[attribute]) {
|
||||||
dest.attrib[attribute] = src.attrib[attribute];
|
dest.attrib[attribute] = src.attrib[attribute];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//Handle text
|
//Handle text
|
||||||
if (src.text && (clobber || !dest.text)) {
|
if (src.text && (clobber || !dest.text)) {
|
||||||
dest.text = src.text;
|
dest.text = src.text;
|
||||||
}
|
}
|
||||||
//Handle platform
|
//Handle platform
|
||||||
if (platform) {
|
if (platform) {
|
||||||
src.findall('platform[@name="' + platform + '"]').forEach(function (platformElement) {
|
src.findall('platform[@name="' + platform + '"]').forEach(function (platformElement) {
|
||||||
platformElement.getchildren().forEach(mergeChild);
|
platformElement.getchildren().forEach(mergeChild);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle children
|
//Handle children
|
||||||
src.getchildren().forEach(mergeChild);
|
src.getchildren().forEach(mergeChild);
|
||||||
|
|
||||||
function mergeChild (srcChild) {
|
function mergeChild (srcChild) {
|
||||||
var srcTag = srcChild.tag,
|
var srcTag = srcChild.tag,
|
||||||
destChild = new et.Element(srcTag),
|
destChild = new et.Element(srcTag),
|
||||||
foundChild,
|
foundChild,
|
||||||
query = srcTag + '',
|
query = srcTag + '',
|
||||||
shouldMerge = true;
|
shouldMerge = true;
|
||||||
|
|
||||||
if (BLACKLIST.indexOf(srcTag) === -1) {
|
if (BLACKLIST.indexOf(srcTag) === -1) {
|
||||||
if (SINGLETONS.indexOf(srcTag) !== -1) {
|
if (SINGLETONS.indexOf(srcTag) !== -1) {
|
||||||
foundChild = dest.find(query);
|
foundChild = dest.find(query);
|
||||||
if (foundChild) {
|
if (foundChild) {
|
||||||
destChild = foundChild;
|
destChild = foundChild;
|
||||||
dest.remove(destChild);
|
dest.remove(destChild);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Check for an exact match and if you find one don't add
|
//Check for an exact match and if you find one don't add
|
||||||
Object.getOwnPropertyNames(srcChild.attrib).forEach(function (attribute) {
|
Object.getOwnPropertyNames(srcChild.attrib).forEach(function (attribute) {
|
||||||
query += '[@' + attribute + '="' + srcChild.attrib[attribute] + '"]';
|
query += '[@' + attribute + '="' + srcChild.attrib[attribute] + '"]';
|
||||||
});
|
});
|
||||||
var foundChildren = dest.findall(query);
|
var foundChildren = dest.findall(query);
|
||||||
for(var i = 0; i < foundChildren.length; i++) {
|
for(var i = 0; i < foundChildren.length; i++) {
|
||||||
foundChild = foundChildren[i];
|
foundChild = foundChildren[i];
|
||||||
if (foundChild && textMatch(srcChild, foundChild) && (Object.keys(srcChild.attrib).length==Object.keys(foundChild.attrib).length)) {
|
if (foundChild && textMatch(srcChild, foundChild) && (Object.keys(srcChild.attrib).length==Object.keys(foundChild.attrib).length)) {
|
||||||
destChild = foundChild;
|
destChild = foundChild;
|
||||||
dest.remove(destChild);
|
dest.remove(destChild);
|
||||||
shouldMerge = false;
|
shouldMerge = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeXml(srcChild, destChild, platform, clobber && shouldMerge);
|
mergeXml(srcChild, destChild, platform, clobber && shouldMerge);
|
||||||
dest.append(destChild);
|
dest.append(destChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expose for testing.
|
// Expose for testing.
|
||||||
module.exports.mergeXml = mergeXml;
|
module.exports.mergeXml = mergeXml;
|
||||||
|
|
||||||
function textMatch(elm1, elm2) {
|
function textMatch(elm1, elm2) {
|
||||||
var text1 = elm1.text ? elm1.text.replace(/\s+/, '') : '',
|
var text1 = elm1.text ? elm1.text.replace(/\s+/, '') : '',
|
||||||
text2 = elm2.text ? elm2.text.replace(/\s+/, '') : '';
|
text2 = elm2.text ? elm2.text.replace(/\s+/, '') : '';
|
||||||
return (text1 === '' || text1 === text2);
|
return (text1 === '' || text1 === text2);
|
||||||
}
|
}
|
||||||
|
0
node_modules/nopt/bin/nopt.js
generated
vendored
Normal file → Executable file
0
node_modules/nopt/bin/nopt.js
generated
vendored
Normal file → Executable file
0
node_modules/shelljs/bin/shjs
generated
vendored
Normal file → Executable file
0
node_modules/shelljs/bin/shjs
generated
vendored
Normal file → Executable file
@ -21,9 +21,9 @@
|
|||||||
"jshint": "node node_modules/jshint/bin/jshint bin && node node_modules/jshint/bin/jshint spec"
|
"jshint": "node node_modules/jshint/bin/jshint bin && node node_modules/jshint/bin/jshint spec"
|
||||||
},
|
},
|
||||||
"author": "Apache Software Foundation",
|
"author": "Apache Software Foundation",
|
||||||
"license": "Apache version 2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cordova-common": "^0.1.0",
|
"cordova-common": "~1.0.0",
|
||||||
"elementtree": "^0.1.6",
|
"elementtree": "^0.1.6",
|
||||||
"nopt": "^3.0.1",
|
"nopt": "^3.0.1",
|
||||||
"properties-parser": "^0.2.3",
|
"properties-parser": "^0.2.3",
|
||||||
|
Loading…
Reference in New Issue
Block a user