You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2016/03/04 00:55:24 UTC
[44/59] [abbrv] [partial] mac commit: CB-10668 added node_modules
directory
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/README.md
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/README.md b/node_modules/elementtree/README.md
new file mode 100644
index 0000000..738420c
--- /dev/null
+++ b/node_modules/elementtree/README.md
@@ -0,0 +1,141 @@
+node-elementtree
+====================
+
+node-elementtree is a [Node.js](http://nodejs.org) XML parser and serializer based upon the [Python ElementTree v1.3](http://effbot.org/zone/element-index.htm) module.
+
+Installation
+====================
+
+ $ npm install elementtree
+
+Using the library
+====================
+
+For the usage refer to the Python ElementTree library documentation - [http://effbot.org/zone/element-index.htm#usage](http://effbot.org/zone/element-index.htm#usage).
+
+Supported XPath expressions in `find`, `findall` and `findtext` methods are listed on [http://effbot.org/zone/element-xpath.htm](http://effbot.org/zone/element-xpath.htm).
+
+Example 1 – Creating An XML Document
+====================
+
+This example shows how to build a valid XML document that can be published to
+Atom Hopper. Atom Hopper is used internally as a bridge from products all the
+way to collecting revenue, called “Usage.” MaaS and other products send similar
+events to it every time user performs an action on a resource
+(e.g. creates,updates or deletes). Below is an example of leveraging the API
+to create a new XML document.
+
+```javascript
+var et = require('elementtree');
+var XML = et.XML;
+var ElementTree = et.ElementTree;
+var element = et.Element;
+var subElement = et.SubElement;
+
+var date, root, tenantId, serviceName, eventType, usageId, dataCenter, region,
+checks, resourceId, category, startTime, resourceName, etree, xml;
+
+date = new Date();
+
+root = element('entry');
+root.set('xmlns', 'http://www.w3.org/2005/Atom');
+
+tenantId = subElement(root, 'TenantId');
+tenantId.text = '12345';
+
+serviceName = subElement(root, 'ServiceName');
+serviceName.text = 'MaaS';
+
+resourceId = subElement(root, 'ResourceID');
+resourceId.text = 'enAAAA';
+
+usageId = subElement(root, 'UsageID');
+usageId.text = '550e8400-e29b-41d4-a716-446655440000';
+
+eventType = subElement(root, 'EventType');
+eventType.text = 'create';
+
+category = subElement(root, 'category');
+category.set('term', 'monitoring.entity.create');
+
+dataCenter = subElement(root, 'DataCenter');
+dataCenter.text = 'global';
+
+region = subElement(root, 'Region');
+region.text = 'global';
+
+startTime = subElement(root, 'StartTime');
+startTime.text = date;
+
+resourceName = subElement(root, 'ResourceName');
+resourceName.text = 'entity';
+
+etree = new ElementTree(root);
+xml = etree.write({'xml_declaration': false});
+console.log(xml);
+```
+
+As you can see, both et.Element and et.SubElement are factory methods which
+return a new instance of Element and SubElement class, respectively.
+When you create a new element (tag) you can use set method to set an attribute.
+To set the tag value, assign a value to the .text attribute.
+
+This example would output a document that looks like this:
+
+```xml
+<entry xmlns="http://www.w3.org/2005/Atom">
+ <TenantId>12345</TenantId>
+ <ServiceName>MaaS</ServiceName>
+ <ResourceID>enAAAA</ResourceID>
+ <UsageID>550e8400-e29b-41d4-a716-446655440000</UsageID>
+ <EventType>create</EventType>
+ <category term="monitoring.entity.create"/>
+ <DataCenter>global</DataCenter>
+ <Region>global</Region>
+ <StartTime>Sun Apr 29 2012 16:37:32 GMT-0700 (PDT)</StartTime>
+ <ResourceName>entity</ResourceName>
+</entry>
+```
+
+Example 2 – Parsing An XML Document
+====================
+
+This example shows how to parse an XML document and use simple XPath selectors.
+For demonstration purposes, we will use the XML document located at
+https://gist.github.com/2554343.
+
+Behind the scenes, node-elementtree uses Isaac’s sax library for parsing XML,
+but the library has a concept of “parsers,” which means it’s pretty simple to
+add support for a different parser.
+
+```javascript
+var fs = require('fs');
+
+var et = require('elementtree');
+
+var XML = et.XML;
+var ElementTree = et.ElementTree;
+var element = et.Element;
+var subElement = et.SubElement;
+
+var data, etree;
+
+data = fs.readFileSync('document.xml').toString();
+etree = et.parse(data);
+
+console.log(etree.findall('./entry/TenantId').length); // 2
+console.log(etree.findtext('./entry/ServiceName')); // MaaS
+console.log(etree.findall('./entry/category')[0].get('term')); // monitoring.entity.create
+console.log(etree.findall('*/category/[@term="monitoring.entity.update"]').length); // 1
+```
+
+Build status
+====================
+
+[![Build Status](https://secure.travis-ci.org/racker/node-elementtree.png)](http://travis-ci.org/racker/node-elementtree)
+
+
+License
+====================
+
+node-elementtree is distributed under the [Apache license](http://www.apache.org/licenses/LICENSE-2.0.html).
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/constants.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/constants.js b/node_modules/elementtree/lib/constants.js
new file mode 100644
index 0000000..b057faf
--- /dev/null
+++ b/node_modules/elementtree/lib/constants.js
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2011 Rackspace
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+var DEFAULT_PARSER = 'sax';
+
+exports.DEFAULT_PARSER = DEFAULT_PARSER;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/elementpath.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/elementpath.js b/node_modules/elementtree/lib/elementpath.js
new file mode 100644
index 0000000..2e93f47
--- /dev/null
+++ b/node_modules/elementtree/lib/elementpath.js
@@ -0,0 +1,343 @@
+/**
+ * Copyright 2011 Rackspace
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+var sprintf = require('./sprintf').sprintf;
+
+var utils = require('./utils');
+var SyntaxError = require('./errors').SyntaxError;
+
+var _cache = {};
+
+var RE = new RegExp(
+ "(" +
+ "'[^']*'|\"[^\"]*\"|" +
+ "::|" +
+ "//?|" +
+ "\\.\\.|" +
+ "\\(\\)|" +
+ "[/.*:\\[\\]\\(\\)@=])|" +
+ "((?:\\{[^}]+\\})?[^/\\[\\]\\(\\)@=\\s]+)|" +
+ "\\s+", 'g'
+);
+
+var xpath_tokenizer = utils.findall.bind(null, RE);
+
+function prepare_tag(next, token) {
+ var tag = token[0];
+
+ function select(context, result) {
+ var i, len, elem, rv = [];
+
+ for (i = 0, len = result.length; i < len; i++) {
+ elem = result[i];
+ elem._children.forEach(function(e) {
+ if (e.tag === tag) {
+ rv.push(e);
+ }
+ });
+ }
+
+ return rv;
+ }
+
+ return select;
+}
+
+function prepare_star(next, token) {
+ function select(context, result) {
+ var i, len, elem, rv = [];
+
+ for (i = 0, len = result.length; i < len; i++) {
+ elem = result[i];
+ elem._children.forEach(function(e) {
+ rv.push(e);
+ });
+ }
+
+ return rv;
+ }
+
+ return select;
+}
+
+function prepare_dot(next, token) {
+ function select(context, result) {
+ var i, len, elem, rv = [];
+
+ for (i = 0, len = result.length; i < len; i++) {
+ elem = result[i];
+ rv.push(elem);
+ }
+
+ return rv;
+ }
+
+ return select;
+}
+
+function prepare_iter(next, token) {
+ var tag;
+ token = next();
+
+ if (token[1] === '*') {
+ tag = '*';
+ }
+ else if (!token[1]) {
+ tag = token[0] || '';
+ }
+ else {
+ throw new SyntaxError(token);
+ }
+
+ function select(context, result) {
+ var i, len, elem, rv = [];
+
+ for (i = 0, len = result.length; i < len; i++) {
+ elem = result[i];
+ elem.iter(tag, function(e) {
+ if (e !== elem) {
+ rv.push(e);
+ }
+ });
+ }
+
+ return rv;
+ }
+
+ return select;
+}
+
+function prepare_dot_dot(next, token) {
+ function select(context, result) {
+ var i, len, elem, rv = [], parent_map = context.parent_map;
+
+ if (!parent_map) {
+ context.parent_map = parent_map = {};
+
+ context.root.iter(null, function(p) {
+ p._children.forEach(function(e) {
+ parent_map[e] = p;
+ });
+ });
+ }
+
+ for (i = 0, len = result.length; i < len; i++) {
+ elem = result[i];
+
+ if (parent_map.hasOwnProperty(elem)) {
+ rv.push(parent_map[elem]);
+ }
+ }
+
+ return rv;
+ }
+
+ return select;
+}
+
+
+function prepare_predicate(next, token) {
+ var tag, key, value, select;
+ token = next();
+
+ if (token[1] === '@') {
+ // attribute
+ token = next();
+
+ if (token[1]) {
+ throw new SyntaxError(token, 'Invalid attribute predicate');
+ }
+
+ key = token[0];
+ token = next();
+
+ if (token[1] === ']') {
+ select = function(context, result) {
+ var i, len, elem, rv = [];
+
+ for (i = 0, len = result.length; i < len; i++) {
+ elem = result[i];
+
+ if (elem.get(key)) {
+ rv.push(elem);
+ }
+ }
+
+ return rv;
+ };
+ }
+ else if (token[1] === '=') {
+ value = next()[1];
+
+ if (value[0] === '"' || value[value.length - 1] === '\'') {
+ value = value.slice(1, value.length - 1);
+ }
+ else {
+ throw new SyntaxError(token, 'Ivalid comparison target');
+ }
+
+ token = next();
+ select = function(context, result) {
+ var i, len, elem, rv = [];
+
+ for (i = 0, len = result.length; i < len; i++) {
+ elem = result[i];
+
+ if (elem.get(key) === value) {
+ rv.push(elem);
+ }
+ }
+
+ return rv;
+ };
+ }
+
+ if (token[1] !== ']') {
+ throw new SyntaxError(token, 'Invalid attribute predicate');
+ }
+ }
+ else if (!token[1]) {
+ tag = token[0] || '';
+ token = next();
+
+ if (token[1] !== ']') {
+ throw new SyntaxError(token, 'Invalid node predicate');
+ }
+
+ select = function(context, result) {
+ var i, len, elem, rv = [];
+
+ for (i = 0, len = result.length; i < len; i++) {
+ elem = result[i];
+
+ if (elem.find(tag)) {
+ rv.push(elem);
+ }
+ }
+
+ return rv;
+ };
+ }
+ else {
+ throw new SyntaxError(null, 'Invalid predicate');
+ }
+
+ return select;
+}
+
+
+
+var ops = {
+ "": prepare_tag,
+ "*": prepare_star,
+ ".": prepare_dot,
+ "..": prepare_dot_dot,
+ "//": prepare_iter,
+ "[": prepare_predicate,
+};
+
+function _SelectorContext(root) {
+ this.parent_map = null;
+ this.root = root;
+}
+
+function findall(elem, path) {
+ var selector, result, i, len, token, value, select, context;
+
+ if (_cache.hasOwnProperty(path)) {
+ selector = _cache[path];
+ }
+ else {
+ // TODO: Use smarter cache purging approach
+ if (Object.keys(_cache).length > 100) {
+ _cache = {};
+ }
+
+ if (path.charAt(0) === '/') {
+ throw new SyntaxError(null, 'Cannot use absolute path on element');
+ }
+
+ result = xpath_tokenizer(path);
+ selector = [];
+
+ function getToken() {
+ return result.shift();
+ }
+
+ token = getToken();
+ while (true) {
+ var c = token[1] || '';
+ value = ops[c](getToken, token);
+
+ if (!value) {
+ throw new SyntaxError(null, sprintf('Invalid path: %s', path));
+ }
+
+ selector.push(value);
+ token = getToken();
+
+ if (!token) {
+ break;
+ }
+ else if (token[1] === '/') {
+ token = getToken();
+ }
+
+ if (!token) {
+ break;
+ }
+ }
+
+ _cache[path] = selector;
+ }
+
+ // Execute slector pattern
+ result = [elem];
+ context = new _SelectorContext(elem);
+
+ for (i = 0, len = selector.length; i < len; i++) {
+ select = selector[i];
+ result = select(context, result);
+ }
+
+ return result || [];
+}
+
+function find(element, path) {
+ var resultElements = findall(element, path);
+
+ if (resultElements && resultElements.length > 0) {
+ return resultElements[0];
+ }
+
+ return null;
+}
+
+function findtext(element, path, defvalue) {
+ var resultElements = findall(element, path);
+
+ if (resultElements && resultElements.length > 0) {
+ return resultElements[0].text;
+ }
+
+ return defvalue;
+}
+
+
+exports.find = find;
+exports.findall = findall;
+exports.findtext = findtext;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/elementtree.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/elementtree.js b/node_modules/elementtree/lib/elementtree.js
new file mode 100644
index 0000000..61d9276
--- /dev/null
+++ b/node_modules/elementtree/lib/elementtree.js
@@ -0,0 +1,611 @@
+/**
+ * Copyright 2011 Rackspace
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+var sprintf = require('./sprintf').sprintf;
+
+var utils = require('./utils');
+var ElementPath = require('./elementpath');
+var TreeBuilder = require('./treebuilder').TreeBuilder;
+var get_parser = require('./parser').get_parser;
+var constants = require('./constants');
+
+var element_ids = 0;
+
+function Element(tag, attrib)
+{
+ this._id = element_ids++;
+ this.tag = tag;
+ this.attrib = {};
+ this.text = null;
+ this.tail = null;
+ this._children = [];
+
+ if (attrib) {
+ this.attrib = utils.merge(this.attrib, attrib);
+ }
+}
+
+Element.prototype.toString = function()
+{
+ return sprintf("<Element %s at %s>", this.tag, this._id);
+};
+
+Element.prototype.makeelement = function(tag, attrib)
+{
+ return new Element(tag, attrib);
+};
+
+Element.prototype.len = function()
+{
+ return this._children.length;
+};
+
+Element.prototype.getItem = function(index)
+{
+ return this._children[index];
+};
+
+Element.prototype.setItem = function(index, element)
+{
+ this._children[index] = element;
+};
+
+Element.prototype.delItem = function(index)
+{
+ this._children.splice(index, 1);
+};
+
+Element.prototype.getSlice = function(start, stop)
+{
+ return this._children.slice(start, stop);
+};
+
+Element.prototype.setSlice = function(start, stop, elements)
+{
+ var i;
+ var k = 0;
+ for (i = start; i < stop; i++, k++) {
+ this._children[i] = elements[k];
+ }
+};
+
+Element.prototype.delSlice = function(start, stop)
+{
+ this._children.splice(start, stop - start);
+};
+
+Element.prototype.append = function(element)
+{
+ this._children.push(element);
+};
+
+Element.prototype.extend = function(elements)
+{
+ this._children.concat(elements);
+};
+
+Element.prototype.insert = function(index, element)
+{
+ this._children[index] = element;
+};
+
+Element.prototype.remove = function(element)
+{
+ this._children = this._children.filter(function(e) {
+ /* TODO: is this the right way to do this? */
+ if (e._id === element._id) {
+ return false;
+ }
+ return true;
+ });
+};
+
+Element.prototype.getchildren = function() {
+ return this._children;
+};
+
+Element.prototype.find = function(path)
+{
+ return ElementPath.find(this, path);
+};
+
+Element.prototype.findtext = function(path, defvalue)
+{
+ return ElementPath.findtext(this, path, defvalue);
+};
+
+Element.prototype.findall = function(path, defvalue)
+{
+ return ElementPath.findall(this, path, defvalue);
+};
+
+Element.prototype.clear = function()
+{
+ this.attrib = {};
+ this._children = [];
+ this.text = null;
+ this.tail = null;
+};
+
+Element.prototype.get = function(key, defvalue)
+{
+ if (this.attrib[key] !== undefined) {
+ return this.attrib[key];
+ }
+ else {
+ return defvalue;
+ }
+};
+
+Element.prototype.set = function(key, value)
+{
+ this.attrib[key] = value;
+};
+
+Element.prototype.keys = function()
+{
+ return Object.keys(this.attrib);
+};
+
+Element.prototype.items = function()
+{
+ return utils.items(this.attrib);
+};
+
+/*
+ * In python this uses a generator, but in v8 we don't have em,
+ * so we use a callback instead.
+ **/
+Element.prototype.iter = function(tag, callback)
+{
+ var self = this;
+ var i, child;
+
+ if (tag === "*") {
+ tag = null;
+ }
+
+ if (tag === null || this.tag === tag) {
+ callback(self);
+ }
+
+ for (i = 0; i < this._children.length; i++) {
+ child = this._children[i];
+ child.iter(tag, function(e) {
+ callback(e);
+ });
+ }
+};
+
+Element.prototype.itertext = function(callback)
+{
+ this.iter(null, function(e) {
+ if (e.text) {
+ callback(e.text);
+ }
+
+ if (e.tail) {
+ callback(e.tail);
+ }
+ });
+};
+
+
+function SubElement(parent, tag, attrib) {
+ var element = parent.makeelement(tag, attrib);
+ parent.append(element);
+ return element;
+}
+
+function Comment(text) {
+ var element = new Element(Comment);
+ if (text) {
+ element.text = text;
+ }
+ return element;
+}
+
+function CData(text) {
+ var element = new Element(CData);
+ if (text) {
+ element.text = text;
+ }
+ return element;
+}
+
+function ProcessingInstruction(target, text)
+{
+ var element = new Element(ProcessingInstruction);
+ element.text = target;
+ if (text) {
+ element.text = element.text + " " + text;
+ }
+ return element;
+}
+
+function QName(text_or_uri, tag)
+{
+ if (tag) {
+ text_or_uri = sprintf("{%s}%s", text_or_uri, tag);
+ }
+ this.text = text_or_uri;
+}
+
+QName.prototype.toString = function() {
+ return this.text;
+};
+
+function ElementTree(element)
+{
+ this._root = element;
+}
+
+ElementTree.prototype.getroot = function() {
+ return this._root;
+};
+
+ElementTree.prototype._setroot = function(element) {
+ this._root = element;
+};
+
+ElementTree.prototype.parse = function(source, parser) {
+ if (!parser) {
+ parser = get_parser(constants.DEFAULT_PARSER);
+ parser = new parser.XMLParser(new TreeBuilder());
+ }
+
+ parser.feed(source);
+ this._root = parser.close();
+ return this._root;
+};
+
+ElementTree.prototype.iter = function(tag, callback) {
+ this._root.iter(tag, callback);
+};
+
+ElementTree.prototype.find = function(path) {
+ return this._root.find(path);
+};
+
+ElementTree.prototype.findtext = function(path, defvalue) {
+ return this._root.findtext(path, defvalue);
+};
+
+ElementTree.prototype.findall = function(path) {
+ return this._root.findall(path);
+};
+
+/**
+ * Unlike ElementTree, we don't write to a file, we return you a string.
+ */
+ElementTree.prototype.write = function(options) {
+ var sb = [];
+ options = utils.merge({
+ encoding: 'utf-8',
+ xml_declaration: null,
+ default_namespace: null,
+ method: 'xml'}, options);
+
+ if (options.xml_declaration !== false) {
+ sb.push("<?xml version='1.0' encoding='"+options.encoding +"'?>\n");
+ }
+
+ if (options.method === "text") {
+ _serialize_text(sb, self._root, encoding);
+ }
+ else {
+ var qnames, namespaces, indent, indent_string;
+ var x = _namespaces(this._root, options.encoding, options.default_namespace);
+ qnames = x[0];
+ namespaces = x[1];
+
+ if (options.hasOwnProperty('indent')) {
+ indent = 0;
+ indent_string = new Array(options.indent + 1).join(' ');
+ }
+ else {
+ indent = false;
+ }
+
+ if (options.method === "xml") {
+ _serialize_xml(function(data) {
+ sb.push(data);
+ }, this._root, options.encoding, qnames, namespaces, indent, indent_string);
+ }
+ else {
+ /* TODO: html */
+ throw new Error("unknown serialization method "+ options.method);
+ }
+ }
+
+ return sb.join("");
+};
+
+var _namespace_map = {
+ /* "well-known" namespace prefixes */
+ "http://www.w3.org/XML/1998/namespace": "xml",
+ "http://www.w3.org/1999/xhtml": "html",
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf",
+ "http://schemas.xmlsoap.org/wsdl/": "wsdl",
+ /* xml schema */
+ "http://www.w3.org/2001/XMLSchema": "xs",
+ "http://www.w3.org/2001/XMLSchema-instance": "xsi",
+ /* dublic core */
+ "http://purl.org/dc/elements/1.1/": "dc",
+};
+
+function register_namespace(prefix, uri) {
+ if (/ns\d+$/.test(prefix)) {
+ throw new Error('Prefix format reserved for internal use');
+ }
+
+ if (_namespace_map.hasOwnProperty(uri) && _namespace_map[uri] === prefix) {
+ delete _namespace_map[uri];
+ }
+
+ _namespace_map[uri] = prefix;
+}
+
+
+function _escape(text, encoding, isAttribute, isText) {
+ if (text) {
+ text = text.toString();
+ text = text.replace(/&/g, '&');
+ text = text.replace(/</g, '<');
+ text = text.replace(/>/g, '>');
+ if (!isText) {
+ text = text.replace(/\n/g, '
');
+ text = text.replace(/\r/g, '
');
+ }
+ if (isAttribute) {
+ text = text.replace(/"/g, '"');
+ }
+ }
+ return text;
+}
+
+/* TODO: benchmark single regex */
+function _escape_attrib(text, encoding) {
+ return _escape(text, encoding, true);
+}
+
+function _escape_cdata(text, encoding) {
+ return _escape(text, encoding, false);
+}
+
+function _escape_text(text, encoding) {
+ return _escape(text, encoding, false, true);
+}
+
+function _namespaces(elem, encoding, default_namespace) {
+ var qnames = {};
+ var namespaces = {};
+
+ if (default_namespace) {
+ namespaces[default_namespace] = "";
+ }
+
+ function encode(text) {
+ return text;
+ }
+
+ function add_qname(qname) {
+ if (qname[0] === "{") {
+ var tmp = qname.substring(1).split("}", 2);
+ var uri = tmp[0];
+ var tag = tmp[1];
+ var prefix = namespaces[uri];
+
+ if (prefix === undefined) {
+ prefix = _namespace_map[uri];
+ if (prefix === undefined) {
+ prefix = "ns" + Object.keys(namespaces).length;
+ }
+ if (prefix !== "xml") {
+ namespaces[uri] = prefix;
+ }
+ }
+
+ if (prefix) {
+ qnames[qname] = sprintf("%s:%s", prefix, tag);
+ }
+ else {
+ qnames[qname] = tag;
+ }
+ }
+ else {
+ if (default_namespace) {
+ throw new Error('cannot use non-qualified names with default_namespace option');
+ }
+
+ qnames[qname] = qname;
+ }
+ }
+
+
+ elem.iter(null, function(e) {
+ var i;
+ var tag = e.tag;
+ var text = e.text;
+ var items = e.items();
+
+ if (tag instanceof QName && qnames[tag.text] === undefined) {
+ add_qname(tag.text);
+ }
+ else if (typeof(tag) === "string") {
+ add_qname(tag);
+ }
+ else if (tag !== null && tag !== Comment && tag !== CData && tag !== ProcessingInstruction) {
+ throw new Error('Invalid tag type for serialization: '+ tag);
+ }
+
+ if (text instanceof QName && qnames[text.text] === undefined) {
+ add_qname(text.text);
+ }
+
+ items.forEach(function(item) {
+ var key = item[0],
+ value = item[1];
+ if (key instanceof QName) {
+ key = key.text;
+ }
+
+ if (qnames[key] === undefined) {
+ add_qname(key);
+ }
+
+ if (value instanceof QName && qnames[value.text] === undefined) {
+ add_qname(value.text);
+ }
+ });
+ });
+ return [qnames, namespaces];
+}
+
+function _serialize_xml(write, elem, encoding, qnames, namespaces, indent, indent_string) {
+ var tag = elem.tag;
+ var text = elem.text;
+ var items;
+ var i;
+
+ var newlines = indent || (indent === 0);
+ write(Array(indent + 1).join(indent_string));
+
+ if (tag === Comment) {
+ write(sprintf("<!--%s-->", _escape_cdata(text, encoding)));
+ }
+ else if (tag === ProcessingInstruction) {
+ write(sprintf("<?%s?>", _escape_cdata(text, encoding)));
+ }
+ else if (tag === CData) {
+ text = text || '';
+ write(sprintf("<![CDATA[%s]]>", text));
+ }
+ else {
+ tag = qnames[tag];
+ if (tag === undefined) {
+ if (text) {
+ write(_escape_text(text, encoding));
+ }
+ elem.iter(function(e) {
+ _serialize_xml(write, e, encoding, qnames, null, newlines ? indent + 1 : false, indent_string);
+ });
+ }
+ else {
+ write("<" + tag);
+ items = elem.items();
+
+ if (items || namespaces) {
+ items.sort(); // lexical order
+
+ items.forEach(function(item) {
+ var k = item[0],
+ v = item[1];
+
+ if (k instanceof QName) {
+ k = k.text;
+ }
+
+ if (v instanceof QName) {
+ v = qnames[v.text];
+ }
+ else {
+ v = _escape_attrib(v, encoding);
+ }
+ write(sprintf(" %s=\"%s\"", qnames[k], v));
+ });
+
+ if (namespaces) {
+ items = utils.items(namespaces);
+ items.sort(function(a, b) { return a[1] < b[1]; });
+
+ items.forEach(function(item) {
+ var k = item[1],
+ v = item[0];
+
+ if (k) {
+ k = ':' + k;
+ }
+
+ write(sprintf(" xmlns%s=\"%s\"", k, _escape_attrib(v, encoding)));
+ });
+ }
+ }
+
+ if (text || elem.len()) {
+ if (text && text.toString().match(/^\s*$/)) {
+ text = null;
+ }
+
+ write(">");
+ if (!text && newlines) {
+ write("\n");
+ }
+
+ if (text) {
+ write(_escape_text(text, encoding));
+ }
+ elem._children.forEach(function(e) {
+ _serialize_xml(write, e, encoding, qnames, null, newlines ? indent + 1 : false, indent_string);
+ });
+
+ if (!text && indent) {
+ write(Array(indent + 1).join(indent_string));
+ }
+ write("</" + tag + ">");
+ }
+ else {
+ write(" />");
+ }
+ }
+ }
+
+ if (newlines) {
+ write("\n");
+ }
+}
+
+function parse(source, parser) {
+ var tree = new ElementTree();
+ tree.parse(source, parser);
+ return tree;
+}
+
+function tostring(element, options) {
+ return new ElementTree(element).write(options);
+}
+
+exports.PI = ProcessingInstruction;
+exports.Comment = Comment;
+exports.CData = CData;
+exports.ProcessingInstruction = ProcessingInstruction;
+exports.SubElement = SubElement;
+exports.QName = QName;
+exports.ElementTree = ElementTree;
+exports.ElementPath = ElementPath;
+exports.Element = function(tag, attrib) {
+ return new Element(tag, attrib);
+};
+
+exports.XML = function(data) {
+ var et = new ElementTree();
+ return et.parse(data);
+};
+
+exports.parse = parse;
+exports.register_namespace = register_namespace;
+exports.tostring = tostring;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/errors.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/errors.js b/node_modules/elementtree/lib/errors.js
new file mode 100644
index 0000000..e8742be
--- /dev/null
+++ b/node_modules/elementtree/lib/errors.js
@@ -0,0 +1,31 @@
+/**
+ * Copyright 2011 Rackspace
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+var util = require('util');
+
+var sprintf = require('./sprintf').sprintf;
+
+function SyntaxError(token, msg) {
+ msg = msg || sprintf('Syntax Error at token %s', token.toString());
+ this.token = token;
+ this.message = msg;
+ Error.call(this, msg);
+}
+
+util.inherits(SyntaxError, Error);
+
+exports.SyntaxError = SyntaxError;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/parser.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/parser.js b/node_modules/elementtree/lib/parser.js
new file mode 100644
index 0000000..7307ee4
--- /dev/null
+++ b/node_modules/elementtree/lib/parser.js
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2011 Rackspace
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/* TODO: support node-expat C++ module optionally */
+
+var util = require('util');
+var parsers = require('./parsers/index');
+
+function get_parser(name) {
+ if (name === 'sax') {
+ return parsers.sax;
+ }
+ else {
+ throw new Error('Invalid parser: ' + name);
+ }
+}
+
+
+exports.get_parser = get_parser;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/parsers/index.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/parsers/index.js b/node_modules/elementtree/lib/parsers/index.js
new file mode 100644
index 0000000..5eac5c8
--- /dev/null
+++ b/node_modules/elementtree/lib/parsers/index.js
@@ -0,0 +1 @@
+exports.sax = require('./sax');
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/parsers/sax.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/parsers/sax.js b/node_modules/elementtree/lib/parsers/sax.js
new file mode 100644
index 0000000..69b0a59
--- /dev/null
+++ b/node_modules/elementtree/lib/parsers/sax.js
@@ -0,0 +1,56 @@
+var util = require('util');
+
+var sax = require('sax');
+
+var TreeBuilder = require('./../treebuilder').TreeBuilder;
+
+function XMLParser(target) {
+ this.parser = sax.parser(true);
+
+ this.target = (target) ? target : new TreeBuilder();
+
+ this.parser.onopentag = this._handleOpenTag.bind(this);
+ this.parser.ontext = this._handleText.bind(this);
+ this.parser.oncdata = this._handleCdata.bind(this);
+ this.parser.ondoctype = this._handleDoctype.bind(this);
+ this.parser.oncomment = this._handleComment.bind(this);
+ this.parser.onclosetag = this._handleCloseTag.bind(this);
+ this.parser.onerror = this._handleError.bind(this);
+}
+
+XMLParser.prototype._handleOpenTag = function(tag) {
+ this.target.start(tag.name, tag.attributes);
+};
+
+XMLParser.prototype._handleText = function(text) {
+ this.target.data(text);
+};
+
+XMLParser.prototype._handleCdata = function(text) {
+ this.target.data(text);
+};
+
+XMLParser.prototype._handleDoctype = function(text) {
+};
+
+XMLParser.prototype._handleComment = function(comment) {
+};
+
+XMLParser.prototype._handleCloseTag = function(tag) {
+ this.target.end(tag);
+};
+
+XMLParser.prototype._handleError = function(err) {
+ throw err;
+};
+
+XMLParser.prototype.feed = function(chunk) {
+ this.parser.write(chunk);
+};
+
+XMLParser.prototype.close = function() {
+ this.parser.close();
+ return this.target.close();
+};
+
+exports.XMLParser = XMLParser;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/sprintf.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/sprintf.js b/node_modules/elementtree/lib/sprintf.js
new file mode 100644
index 0000000..f802c1b
--- /dev/null
+++ b/node_modules/elementtree/lib/sprintf.js
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2011 Rackspace
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+var cache = {};
+
+
+// Do any others need escaping?
+var TO_ESCAPE = {
+ '\'': '\\\'',
+ '\n': '\\n'
+};
+
+
+function populate(formatter) {
+ var i, type,
+ key = formatter,
+ prev = 0,
+ arg = 1,
+ builder = 'return \'';
+
+ for (i = 0; i < formatter.length; i++) {
+ if (formatter[i] === '%') {
+ type = formatter[i + 1];
+
+ switch (type) {
+ case 's':
+ builder += formatter.slice(prev, i) + '\' + arguments[' + arg + '] + \'';
+ prev = i + 2;
+ arg++;
+ break;
+ case 'j':
+ builder += formatter.slice(prev, i) + '\' + JSON.stringify(arguments[' + arg + ']) + \'';
+ prev = i + 2;
+ arg++;
+ break;
+ case '%':
+ builder += formatter.slice(prev, i + 1);
+ prev = i + 2;
+ i++;
+ break;
+ }
+
+
+ } else if (TO_ESCAPE[formatter[i]]) {
+ builder += formatter.slice(prev, i) + TO_ESCAPE[formatter[i]];
+ prev = i + 1;
+ }
+ }
+
+ builder += formatter.slice(prev) + '\';';
+ cache[key] = new Function(builder);
+}
+
+
+/**
+ * A fast version of sprintf(), which currently only supports the %s and %j.
+ * This caches a formatting function for each format string that is used, so
+ * you should only use this sprintf() will be called many times with a single
+ * format string and a limited number of format strings will ever be used (in
+ * general this means that format strings should be string literals).
+ *
+ * @param {String} formatter A format string.
+ * @param {...String} var_args Values that will be formatted by %s and %j.
+ * @return {String} The formatted output.
+ */
+exports.sprintf = function(formatter, var_args) {
+ if (!cache[formatter]) {
+ populate(formatter);
+ }
+
+ return cache[formatter].apply(null, arguments);
+};
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/treebuilder.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/treebuilder.js b/node_modules/elementtree/lib/treebuilder.js
new file mode 100644
index 0000000..393a98f
--- /dev/null
+++ b/node_modules/elementtree/lib/treebuilder.js
@@ -0,0 +1,60 @@
+function TreeBuilder(element_factory) {
+ this._data = [];
+ this._elem = [];
+ this._last = null;
+ this._tail = null;
+ if (!element_factory) {
+ /* evil circular dep */
+ element_factory = require('./elementtree').Element;
+ }
+ this._factory = element_factory;
+}
+
+TreeBuilder.prototype.close = function() {
+ return this._last;
+};
+
+TreeBuilder.prototype._flush = function() {
+ if (this._data) {
+ if (this._last !== null) {
+ var text = this._data.join("");
+ if (this._tail) {
+ this._last.tail = text;
+ }
+ else {
+ this._last.text = text;
+ }
+ }
+ this._data = [];
+ }
+};
+
+TreeBuilder.prototype.data = function(data) {
+ this._data.push(data);
+};
+
+TreeBuilder.prototype.start = function(tag, attrs) {
+ this._flush();
+ var elem = this._factory(tag, attrs);
+ this._last = elem;
+
+ if (this._elem.length) {
+ this._elem[this._elem.length - 1].append(elem);
+ }
+
+ this._elem.push(elem);
+
+ this._tail = null;
+};
+
+TreeBuilder.prototype.end = function(tag) {
+ this._flush();
+ this._last = this._elem.pop();
+ if (this._last.tag !== tag) {
+ throw new Error("end tag mismatch");
+ }
+ this._tail = 1;
+ return this._last;
+};
+
+exports.TreeBuilder = TreeBuilder;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/lib/utils.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/lib/utils.js b/node_modules/elementtree/lib/utils.js
new file mode 100644
index 0000000..b08a670
--- /dev/null
+++ b/node_modules/elementtree/lib/utils.js
@@ -0,0 +1,72 @@
+/**
+ * Copyright 2011 Rackspace
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * @param {Object} hash.
+ * @param {Array} ignored.
+ */
+function items(hash, ignored) {
+ ignored = ignored || null;
+ var k, rv = [];
+
+ function is_ignored(key) {
+ if (!ignored || ignored.length === 0) {
+ return false;
+ }
+
+ return ignored.indexOf(key);
+ }
+
+ for (k in hash) {
+ if (hash.hasOwnProperty(k) && !(is_ignored(ignored))) {
+ rv.push([k, hash[k]]);
+ }
+ }
+
+ return rv;
+}
+
+
+function findall(re, str) {
+ var match, matches = [];
+
+ while ((match = re.exec(str))) {
+ matches.push(match);
+ }
+
+ return matches;
+}
+
+function merge(a, b) {
+ var c = {}, attrname;
+
+ for (attrname in a) {
+ if (a.hasOwnProperty(attrname)) {
+ c[attrname] = a[attrname];
+ }
+ }
+ for (attrname in b) {
+ if (b.hasOwnProperty(attrname)) {
+ c[attrname] = b[attrname];
+ }
+ }
+ return c;
+}
+
+exports.items = items;
+exports.findall = findall;
+exports.merge = merge;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/package.json
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/package.json b/node_modules/elementtree/package.json
new file mode 100644
index 0000000..f6d1ed1
--- /dev/null
+++ b/node_modules/elementtree/package.json
@@ -0,0 +1,100 @@
+{
+ "_args": [
+ [
+ "elementtree@^0.1.6",
+ "/Users/steveng/repo/cordova/cordova-osx/node_modules/cordova-common"
+ ]
+ ],
+ "_from": "elementtree@>=0.1.6 <0.2.0",
+ "_id": "elementtree@0.1.6",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/elementtree",
+ "_npmUser": {
+ "email": "ryan@trolocsis.com",
+ "name": "rphillips"
+ },
+ "_npmVersion": "1.3.24",
+ "_phantomChildren": {},
+ "_requested": {
+ "name": "elementtree",
+ "raw": "elementtree@^0.1.6",
+ "rawSpec": "^0.1.6",
+ "scope": null,
+ "spec": ">=0.1.6 <0.2.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/cordova-common"
+ ],
+ "_resolved": "http://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz",
+ "_shasum": "2ac4c46ea30516c8c4cbdb5e3ac7418e592de20c",
+ "_shrinkwrap": null,
+ "_spec": "elementtree@^0.1.6",
+ "_where": "/Users/steveng/repo/cordova/cordova-osx/node_modules/cordova-common",
+ "author": {
+ "name": "Rackspace US, Inc."
+ },
+ "bugs": {
+ "url": "https://github.com/racker/node-elementtree/issues"
+ },
+ "contributors": [
+ {
+ "name": "Paul Querna",
+ "email": "paul.querna@rackspace.com"
+ },
+ {
+ "name": "Tomaz Muraus",
+ "email": "tomaz.muraus@rackspace.com"
+ }
+ ],
+ "dependencies": {
+ "sax": "0.3.5"
+ },
+ "description": "XML Serialization and Parsing module based on Python's ElementTree.",
+ "devDependencies": {
+ "whiskey": "0.8.x"
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "dist": {
+ "shasum": "2ac4c46ea30516c8c4cbdb5e3ac7418e592de20c",
+ "tarball": "http://registry.npmjs.org/elementtree/-/elementtree-0.1.6.tgz"
+ },
+ "engines": {
+ "node": ">= 0.4.0"
+ },
+ "homepage": "https://github.com/racker/node-elementtree",
+ "keywords": [
+ "elementtree",
+ "parser",
+ "sax",
+ "seralization",
+ "xml"
+ ],
+ "licenses": [
+ {
+ "type": "Apache",
+ "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
+ }
+ ],
+ "main": "lib/elementtree.js",
+ "maintainers": [
+ {
+ "name": "rphillips",
+ "email": "ryan@trolocsis.com"
+ }
+ ],
+ "name": "elementtree",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/racker/node-elementtree.git"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "version": "0.1.6"
+}
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/tests/data/xml1.xml
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/tests/data/xml1.xml b/node_modules/elementtree/tests/data/xml1.xml
new file mode 100644
index 0000000..72c33ae
--- /dev/null
+++ b/node_modules/elementtree/tests/data/xml1.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<container name="test_container_1" xmlns:android="http://schemas.android.com/apk/res/android">
+ <object>dd
+ <name>test_object_1</name>
+ <hash>4281c348eaf83e70ddce0e07221c3d28</hash>
+ <bytes android:type="cool">14</bytes>
+ <content_type>application/octetstream</content_type>
+ <last_modified>2009-02-03T05:26:32.612278</last_modified>
+ </object>
+ <object>
+ <name>test_object_2</name>
+ <hash>b039efe731ad111bc1b0ef221c3849d0</hash>
+ <bytes android:type="lame">64</bytes>
+ <content_type>application/octetstream</content_type>
+ <last_modified>2009-02-03T05:26:32.612278</last_modified>
+ </object>
+</container>
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/tests/data/xml2.xml
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/tests/data/xml2.xml b/node_modules/elementtree/tests/data/xml2.xml
new file mode 100644
index 0000000..5f94bbd
--- /dev/null
+++ b/node_modules/elementtree/tests/data/xml2.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<object>
+ <title>
+ Hello World
+ </title>
+ <children>
+ <object id="obj1" />
+ <object id="obj2" />
+ <object id="obj3" />
+ </children>
+ <text><![CDATA[
+ Test & Test & Test
+ ]]></text>
+</object>
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/elementtree/tests/test-simple.js
----------------------------------------------------------------------
diff --git a/node_modules/elementtree/tests/test-simple.js b/node_modules/elementtree/tests/test-simple.js
new file mode 100644
index 0000000..1fc04b8
--- /dev/null
+++ b/node_modules/elementtree/tests/test-simple.js
@@ -0,0 +1,339 @@
+/**
+ * Copyright 2011 Rackspace
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+var fs = require('fs');
+var path = require('path');
+
+var sprintf = require('./../lib/sprintf').sprintf;
+var et = require('elementtree');
+var XML = et.XML;
+var ElementTree = et.ElementTree;
+var Element = et.Element;
+var SubElement = et.SubElement;
+var SyntaxError = require('./../lib/errors').SyntaxError;
+
+function readFile(name) {
+ return fs.readFileSync(path.join(__dirname, '/data/', name), 'utf8');
+}
+
+exports['test_simplest'] = function(test, assert) {
+ /* Ported from <https://github.com/lxml/lxml/blob/master/src/lxml/tests/test_elementtree.py> */
+ var Element = et.Element;
+ var root = Element('root');
+ root.append(Element('one'));
+ root.append(Element('two'));
+ root.append(Element('three'));
+ assert.equal(3, root.len());
+ assert.equal('one', root.getItem(0).tag);
+ assert.equal('two', root.getItem(1).tag);
+ assert.equal('three', root.getItem(2).tag);
+ test.finish();
+};
+
+
+exports['test_attribute_values'] = function(test, assert) {
+ var XML = et.XML;
+ var root = XML('<doc alpha="Alpha" beta="Beta" gamma="Gamma"/>');
+ assert.equal('Alpha', root.attrib['alpha']);
+ assert.equal('Beta', root.attrib['beta']);
+ assert.equal('Gamma', root.attrib['gamma']);
+ test.finish();
+};
+
+
+exports['test_findall'] = function(test, assert) {
+ var XML = et.XML;
+ var root = XML('<a><b><c/></b><b/><c><b/></c></a>');
+
+ assert.equal(root.findall("c").length, 1);
+ assert.equal(root.findall(".//c").length, 2);
+ assert.equal(root.findall(".//b").length, 3);
+ assert.equal(root.findall(".//b")[0]._children.length, 1);
+ assert.equal(root.findall(".//b")[1]._children.length, 0);
+ assert.equal(root.findall(".//b")[2]._children.length, 0);
+ assert.deepEqual(root.findall('.//b')[0], root.getchildren()[0]);
+
+ test.finish();
+};
+
+exports['test_find'] = function(test, assert) {
+ var a = Element('a');
+ var b = SubElement(a, 'b');
+ var c = SubElement(a, 'c');
+
+ assert.deepEqual(a.find('./b/..'), a);
+ test.finish();
+};
+
+exports['test_elementtree_find_qname'] = function(test, assert) {
+ var tree = new et.ElementTree(XML('<a><b><c/></b><b/><c><b/></c></a>'));
+ assert.deepEqual(tree.find(new et.QName('c')), tree.getroot()._children[2]);
+ test.finish();
+};
+
+exports['test_attrib_ns_clear'] = function(test, assert) {
+ var attribNS = '{http://foo/bar}x';
+
+ var par = Element('par');
+ par.set(attribNS, 'a');
+ var child = SubElement(par, 'child');
+ child.set(attribNS, 'b');
+
+ assert.equal('a', par.get(attribNS));
+ assert.equal('b', child.get(attribNS));
+
+ par.clear();
+ assert.equal(null, par.get(attribNS));
+ assert.equal('b', child.get(attribNS));
+ test.finish();
+};
+
+exports['test_create_tree_and_parse_simple'] = function(test, assert) {
+ var i = 0;
+ var e = new Element('bar', {});
+ var expected = "<?xml version='1.0' encoding='utf-8'?>\n" +
+ '<bar><blah a="11" /><blah a="12" /><gag a="13" b="abc">ponies</gag></bar>';
+
+ SubElement(e, "blah", {a: 11});
+ SubElement(e, "blah", {a: 12});
+ var se = et.SubElement(e, "gag", {a: '13', b: 'abc'});
+ se.text = 'ponies';
+
+ se.itertext(function(text) {
+ assert.equal(text, 'ponies');
+ i++;
+ });
+
+ assert.equal(i, 1);
+ var etree = new ElementTree(e);
+ var xml = etree.write();
+ assert.equal(xml, expected);
+ test.finish();
+};
+
+exports['test_write_with_options'] = function(test, assert) {
+ var i = 0;
+ var e = new Element('bar', {});
+ var expected1 = "<?xml version='1.0' encoding='utf-8'?>\n" +
+ '<bar>\n' +
+ ' <blah a="11">\n' +
+ ' <baz d="11">test</baz>\n' +
+ ' </blah>\n' +
+ ' <blah a="12" />\n' +
+ ' <gag a="13" b="abc">ponies</gag>\n' +
+ '</bar>\n';
+ var expected2 = "<?xml version='1.0' encoding='utf-8'?>\n" +
+ '<bar>\n' +
+ ' <blah a="11">\n' +
+ ' <baz d="11">test</baz>\n' +
+ ' </blah>\n' +
+ ' <blah a="12" />\n' +
+ ' <gag a="13" b="abc">ponies</gag>\n' +
+ '</bar>\n';
+
+ var expected3 = "<?xml version='1.0' encoding='utf-8'?>\n" +
+ '<object>\n' +
+ ' <title>\n' +
+ ' Hello World\n' +
+ ' </title>\n' +
+ ' <children>\n' +
+ ' <object id="obj1" />\n' +
+ ' <object id="obj2" />\n' +
+ ' <object id="obj3" />\n' +
+ ' </children>\n' +
+ ' <text>\n' +
+ ' Test & Test & Test\n' +
+ ' </text>\n' +
+ '</object>\n';
+
+ var se1 = SubElement(e, "blah", {a: 11});
+ var se2 = SubElement(se1, "baz", {d: 11});
+ se2.text = 'test';
+ SubElement(e, "blah", {a: 12});
+ var se = et.SubElement(e, "gag", {a: '13', b: 'abc'});
+ se.text = 'ponies';
+
+ se.itertext(function(text) {
+ assert.equal(text, 'ponies');
+ i++;
+ });
+
+ assert.equal(i, 1);
+ var etree = new ElementTree(e);
+ var xml1 = etree.write({'indent': 4});
+ var xml2 = etree.write({'indent': 2});
+ assert.equal(xml1, expected1);
+ assert.equal(xml2, expected2);
+
+ var file = readFile('xml2.xml');
+ var etree2 = et.parse(file);
+ var xml3 = etree2.write({'indent': 4});
+ assert.equal(xml3, expected3);
+ test.finish();
+};
+
+exports['test_parse_and_find_2'] = function(test, assert) {
+ var data = readFile('xml1.xml');
+ var etree = et.parse(data);
+
+ assert.equal(etree.findall('./object').length, 2);
+ assert.equal(etree.findall('[@name]').length, 1);
+ assert.equal(etree.findall('[@name="test_container_1"]').length, 1);
+ assert.equal(etree.findall('[@name=\'test_container_1\']').length, 1);
+ assert.equal(etree.findall('./object')[0].findtext('name'), 'test_object_1');
+ assert.equal(etree.findtext('./object/name'), 'test_object_1');
+ assert.equal(etree.findall('.//bytes').length, 2);
+ assert.equal(etree.findall('*/bytes').length, 2);
+ assert.equal(etree.findall('*/foobar').length, 0);
+
+ test.finish();
+};
+
+exports['test_namespaced_attribute'] = function(test, assert) {
+ var data = readFile('xml1.xml');
+ var etree = et.parse(data);
+
+ assert.equal(etree.findall('*/bytes[@android:type="cool"]').length, 1);
+
+ test.finish();
+}
+
+exports['test_syntax_errors'] = function(test, assert) {
+ var expressions = [ './/@bar', '[@bar', '[@foo=bar]', '[@', '/bar' ];
+ var errCount = 0;
+ var data = readFile('xml1.xml');
+ var etree = et.parse(data);
+
+ expressions.forEach(function(expression) {
+ try {
+ etree.findall(expression);
+ }
+ catch (err) {
+ errCount++;
+ }
+ });
+
+ assert.equal(errCount, expressions.length);
+ test.finish();
+};
+
+exports['test_register_namespace'] = function(test, assert){
+ var prefix = 'TESTPREFIX';
+ var namespace = 'http://seriously.unknown/namespace/URI';
+ var errCount = 0;
+
+ var etree = Element(sprintf('{%s}test', namespace));
+ assert.equal(et.tostring(etree, { 'xml_declaration': false}),
+ sprintf('<ns0:test xmlns:ns0="%s" />', namespace));
+
+ et.register_namespace(prefix, namespace);
+ var etree = Element(sprintf('{%s}test', namespace));
+ assert.equal(et.tostring(etree, { 'xml_declaration': false}),
+ sprintf('<%s:test xmlns:%s="%s" />', prefix, prefix, namespace));
+
+ try {
+ et.register_namespace('ns25', namespace);
+ }
+ catch (err) {
+ errCount++;
+ }
+
+ assert.equal(errCount, 1, 'Reserved prefix used, but exception was not thrown');
+ test.finish();
+};
+
+exports['test_tostring'] = function(test, assert) {
+ var a = Element('a');
+ var b = SubElement(a, 'b');
+ var c = SubElement(a, 'c');
+ c.text = 543;
+
+ assert.equal(et.tostring(a, { 'xml_declaration': false }), '<a><b /><c>543</c></a>');
+ assert.equal(et.tostring(c, { 'xml_declaration': false }), '<c>543</c>');
+ test.finish();
+};
+
+exports['test_escape'] = function(test, assert) {
+ var a = Element('a');
+ var b = SubElement(a, 'b');
+ b.text = '&&&&<>"\n\r';
+
+ assert.equal(et.tostring(a, { 'xml_declaration': false }), '<a><b>&&&&<>\"\n\r</b></a>');
+ test.finish();
+};
+
+exports['test_find_null'] = function(test, assert) {
+ var root = Element('root');
+ var node = SubElement(root, 'node');
+ var leaf = SubElement(node, 'leaf');
+ leaf.text = 'ipsum';
+
+ assert.equal(root.find('node/leaf'), leaf);
+ assert.equal(root.find('no-such-node/leaf'), null);
+ test.finish();
+};
+
+exports['test_findtext_null'] = function(test, assert) {
+ var root = Element('root');
+ var node = SubElement(root, 'node');
+ var leaf = SubElement(node, 'leaf');
+ leaf.text = 'ipsum';
+
+ assert.equal(root.findtext('node/leaf'), 'ipsum');
+ assert.equal(root.findtext('no-such-node/leaf'), null);
+ test.finish();
+};
+
+exports['test_remove'] = function(test, assert) {
+ var root = Element('root');
+ var node1 = SubElement(root, 'node1');
+ var node2 = SubElement(root, 'node2');
+ var node3 = SubElement(root, 'node3');
+
+ assert.equal(root.len(), 3);
+
+ root.remove(node2);
+
+ assert.equal(root.len(), 2);
+ assert.equal(root.getItem(0).tag, 'node1')
+ assert.equal(root.getItem(1).tag, 'node3')
+
+ test.finish();
+};
+
+exports['test_cdata_write'] = function(test, assert) {
+ var root, etree, xml, values, value, i;
+
+ values = [
+ 'if(0>1) then true;',
+ '<test1>ponies hello</test1>',
+ ''
+ ];
+
+ for (i = 0; i < values.length; i++) {
+ value = values[i];
+
+ root = Element('root');
+ root.append(et.CData(value));
+ etree = new ElementTree(root);
+ xml = etree.write({'xml_declaration': false});
+
+ assert.equal(xml, sprintf('<root><![CDATA[%s]]></root>', value));
+ }
+
+ test.finish();
+};
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/glob/LICENSE
----------------------------------------------------------------------
diff --git a/node_modules/glob/LICENSE b/node_modules/glob/LICENSE
new file mode 100644
index 0000000..19129e3
--- /dev/null
+++ b/node_modules/glob/LICENSE
@@ -0,0 +1,15 @@
+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.
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/glob/README.md
----------------------------------------------------------------------
diff --git a/node_modules/glob/README.md b/node_modules/glob/README.md
new file mode 100644
index 0000000..063cf95
--- /dev/null
+++ b/node_modules/glob/README.md
@@ -0,0 +1,377 @@
+[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Dependency Status](https://david-dm.org/isaacs/node-glob.svg)](https://david-dm.org/isaacs/node-glob) [![devDependency Status](https://david-dm.org/isaacs/node-glob/dev-status.svg)](https://david-dm.org/isaacs/node-glob#info=devDependencies) [![optionalDependency Status](https://david-dm.org/isaacs/node-glob/optional-status.svg)](https://david-dm.org/isaacs/node-glob#info=optionalDependencies)
+
+# Glob
+
+Match files using the patterns the shell uses, like stars and stuff.
+
+This is a glob implementation in JavaScript. It uses the `minimatch`
+library to do its matching.
+
+![](oh-my-glob.gif)
+
+## Usage
+
+```javascript
+var glob = require("glob")
+
+// options is optional
+glob("**/*.js", options, function (er, files) {
+ // files is an array of filenames.
+ // If the `nonull` option is set, and nothing
+ // was found, then files is ["**/*.js"]
+ // er is an error object or null.
+})
+```
+
+## Glob Primer
+
+"Globs" are the patterns you type when you do stuff like `ls *.js` on
+the command line, or put `build/*` in a `.gitignore` file.
+
+Before parsing the path part patterns, braced sections are expanded
+into a set. Braced sections start with `{` and end with `}`, with any
+number of comma-delimited sections within. Braced sections may contain
+slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`.
+
+The following characters have special magic meaning when used in a
+path portion:
+
+* `*` Matches 0 or more characters in a single path portion
+* `?` Matches 1 character
+* `[...]` Matches a range of characters, similar to a RegExp range.
+ If the first character of the range is `!` or `^` then it matches
+ any character not in the range.
+* `!(pattern|pattern|pattern)` Matches anything that does not match
+ any of the patterns provided.
+* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the
+ patterns provided.
+* `+(pattern|pattern|pattern)` Matches one or more occurrences of the
+ patterns provided.
+* `*(a|b|c)` Matches zero or more occurrences of the patterns provided
+* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns
+ provided
+* `**` If a "globstar" is alone in a path portion, then it matches
+ zero or more directories and subdirectories searching for matches.
+ It does not crawl symlinked directories.
+
+### Dots
+
+If a file or directory path portion has a `.` as the first character,
+then it will not match any glob pattern unless that pattern's
+corresponding path part also has a `.` as its first character.
+
+For example, the pattern `a/.*/c` would match the file at `a/.b/c`.
+However the pattern `a/*/c` would not, because `*` does not start with
+a dot character.
+
+You can make glob treat dots as normal characters by setting
+`dot:true` in the options.
+
+### Basename Matching
+
+If you set `matchBase:true` in the options, and the pattern has no
+slashes in it, then it will seek for any file anywhere in the tree
+with a matching basename. For example, `*.js` would match
+`test/simple/basic.js`.
+
+### Negation
+
+The intent for negation would be for a pattern starting with `!` to
+match everything that *doesn't* match the supplied pattern. However,
+the implementation is weird, and for the time being, this should be
+avoided. The behavior is deprecated in version 5, and will be removed
+entirely in version 6.
+
+### Empty Sets
+
+If no matching files are found, then an empty array is returned. This
+differs from the shell, where the pattern itself is returned. For
+example:
+
+ $ echo a*s*d*f
+ a*s*d*f
+
+To get the bash-style behavior, set the `nonull:true` in the options.
+
+### See Also:
+
+* `man sh`
+* `man bash` (Search for "Pattern Matching")
+* `man 3 fnmatch`
+* `man 5 gitignore`
+* [minimatch documentation](https://github.com/isaacs/minimatch)
+
+## glob.hasMagic(pattern, [options])
+
+Returns `true` if there are any special characters in the pattern, and
+`false` otherwise.
+
+Note that the options affect the results. If `noext:true` is set in
+the options object, then `+(a|b)` will not be considered a magic
+pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`
+then that is considered magical, unless `nobrace:true` is set in the
+options.
+
+## glob(pattern, [options], cb)
+
+* `pattern` {String} Pattern to be matched
+* `options` {Object}
+* `cb` {Function}
+ * `err` {Error | null}
+ * `matches` {Array<String>} filenames found matching the pattern
+
+Perform an asynchronous glob search.
+
+## glob.sync(pattern, [options])
+
+* `pattern` {String} Pattern to be matched
+* `options` {Object}
+* return: {Array<String>} filenames found matching the pattern
+
+Perform a synchronous glob search.
+
+## Class: glob.Glob
+
+Create a Glob object by instantiating the `glob.Glob` class.
+
+```javascript
+var Glob = require("glob").Glob
+var mg = new Glob(pattern, options, cb)
+```
+
+It's an EventEmitter, and starts walking the filesystem to find matches
+immediately.
+
+### new glob.Glob(pattern, [options], [cb])
+
+* `pattern` {String} pattern to search for
+* `options` {Object}
+* `cb` {Function} Called when an error occurs, or matches are found
+ * `err` {Error | null}
+ * `matches` {Array<String>} filenames found matching the pattern
+
+Note that if the `sync` flag is set in the options, then matches will
+be immediately available on the `g.found` member.
+
+### Properties
+
+* `minimatch` The minimatch object that the glob uses.
+* `options` The options object passed in.
+* `aborted` Boolean which is set to true when calling `abort()`. There
+ is no way at this time to continue a glob search after aborting, but
+ you can re-use the statCache to avoid having to duplicate syscalls.
+* `cache` Convenience object. Each field has the following possible
+ values:
+ * `false` - Path does not exist
+ * `true` - Path exists
+ * `'DIR'` - Path exists, and is not a directory
+ * `'FILE'` - Path exists, and is a directory
+ * `[file, entries, ...]` - Path exists, is a directory, and the
+ array value is the results of `fs.readdir`
+* `statCache` Cache of `fs.stat` results, to prevent statting the same
+ path multiple times.
+* `symlinks` A record of which paths are symbolic links, which is
+ relevant in resolving `**` patterns.
+* `realpathCache` An optional object which is passed to `fs.realpath`
+ to minimize unnecessary syscalls. It is stored on the instantiated
+ Glob object, and may be re-used.
+
+### Events
+
+* `end` When the matching is finished, this is emitted with all the
+ matches found. If the `nonull` option is set, and no match was found,
+ then the `matches` list contains the original pattern. The matches
+ are sorted, unless the `nosort` flag is set.
+* `match` Every time a match is found, this is emitted with the matched.
+* `error` Emitted when an unexpected error is encountered, or whenever
+ any fs error occurs if `options.strict` is set.
+* `abort` When `abort()` is called, this event is raised.
+
+### Methods
+
+* `pause` Temporarily stop the search
+* `resume` Resume the search
+* `abort` Stop the search forever
+
+### Options
+
+All the options that can be passed to Minimatch can also be passed to
+Glob to change pattern matching behavior. Also, some have been added,
+or have glob-specific ramifications.
+
+All options are false by default, unless otherwise noted.
+
+All options are added to the Glob object, as well.
+
+If you are running many `glob` operations, you can pass a Glob object
+as the `options` argument to a subsequent operation to shortcut some
+`stat` and `readdir` calls. At the very least, you may pass in shared
+`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that
+parallel glob operations will be sped up by sharing information about
+the filesystem.
+
+* `cwd` The current working directory in which to search. Defaults
+ to `process.cwd()`.
+* `root` The place where patterns starting with `/` will be mounted
+ onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
+ systems, and `C:\` or some such on Windows.)
+* `dot` Include `.dot` files in normal matches and `globstar` matches.
+ Note that an explicit dot in a portion of the pattern will always
+ match dot files.
+* `nomount` By default, a pattern starting with a forward-slash will be
+ "mounted" onto the root setting, so that a valid filesystem path is
+ returned. Set this flag to disable that behavior.
+* `mark` Add a `/` character to directory matches. Note that this
+ requires additional stat calls.
+* `nosort` Don't sort the results.
+* `stat` Set to true to stat *all* results. This reduces performance
+ somewhat, and is completely unnecessary, unless `readdir` is presumed
+ to be an untrustworthy indicator of file existence.
+* `silent` When an unusual error is encountered when attempting to
+ read a directory, a warning will be printed to stderr. Set the
+ `silent` option to true to suppress these warnings.
+* `strict` When an unusual error is encountered when attempting to
+ read a directory, the process will just continue on in search of
+ other matches. Set the `strict` option to raise an error in these
+ cases.
+* `cache` See `cache` property above. Pass in a previously generated
+ cache object to save some fs calls.
+* `statCache` A cache of results of filesystem information, to prevent
+ unnecessary stat calls. While it should not normally be necessary
+ to set this, you may pass the statCache from one glob() call to the
+ options object of another, if you know that the filesystem will not
+ change between calls. (See "Race Conditions" below.)
+* `symlinks` A cache of known symbolic links. You may pass in a
+ previously generated `symlinks` object to save `lstat` calls when
+ resolving `**` matches.
+* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead.
+* `nounique` In some cases, brace-expanded patterns can result in the
+ same file showing up multiple times in the result set. By default,
+ this implementation prevents duplicates in the result set. Set this
+ flag to disable that behavior.
+* `nonull` Set to never return an empty set, instead returning a set
+ containing the pattern itself. This is the default in glob(3).
+* `debug` Set to enable debug logging in minimatch and glob.
+* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets.
+* `noglobstar` Do not match `**` against multiple filenames. (Ie,
+ treat it as a normal `*` instead.)
+* `noext` Do not match `+(a|b)` "extglob" patterns.
+* `nocase` Perform a case-insensitive match. Note: on
+ case-insensitive filesystems, non-magic patterns will match by
+ default, since `stat` and `readdir` will not raise errors.
+* `matchBase` Perform a basename-only match if the pattern does not
+ contain any slash characters. That is, `*.js` would be treated as
+ equivalent to `**/*.js`, matching all js files in all directories.
+* `nodir` Do not match directories, only files. (Note: to match
+ *only* directories, simply put a `/` at the end of the pattern.)
+* `ignore` Add a pattern or an array of patterns to exclude matches.
+* `follow` Follow symlinked directories when expanding `**` patterns.
+ Note that this can result in a lot of duplicate references in the
+ presence of cyclic links.
+* `realpath` Set to true to call `fs.realpath` on all of the results.
+ In the case of a symlink that cannot be resolved, the full absolute
+ path to the matched entry is returned (though it will usually be a
+ broken symlink)
+* `nonegate` Suppress deprecated `negate` behavior. (See below.)
+ Default=true
+* `nocomment` Suppress deprecated `comment` behavior. (See below.)
+ Default=true
+
+## Comparisons to other fnmatch/glob implementations
+
+While strict compliance with the existing standards is a worthwhile
+goal, some discrepancies exist between node-glob and other
+implementations, and are intentional.
+
+The double-star character `**` is supported by default, unless the
+`noglobstar` flag is set. This is supported in the manner of bsdglob
+and bash 4.3, where `**` only has special significance if it is the only
+thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
+`a/**b` will not.
+
+Note that symlinked directories are not crawled as part of a `**`,
+though their contents may match against subsequent portions of the
+pattern. This prevents infinite loops and duplicates and the like.
+
+If an escaped pattern has no matches, and the `nonull` flag is set,
+then glob returns the pattern as-provided, rather than
+interpreting the character escapes. For example,
+`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
+`"*a?"`. This is akin to setting the `nullglob` option in bash, except
+that it does not resolve escaped pattern characters.
+
+If brace expansion is not disabled, then it is performed before any
+other interpretation of the glob pattern. Thus, a pattern like
+`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
+**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
+checked for validity. Since those two are valid, matching proceeds.
+
+### Comments and Negation
+
+**Note**: In version 5 of this module, negation and comments are
+**disabled** by default. You can explicitly set `nonegate:false` or
+`nocomment:false` to re-enable them. They are going away entirely in
+version 6.
+
+The intent for negation would be for a pattern starting with `!` to
+match everything that *doesn't* match the supplied pattern. However,
+the implementation is weird. It is better to use the `ignore` option
+to set a pattern or set of patterns to exclude from matches. If you
+want the "everything except *x*" type of behavior, you can use `**` as
+the main pattern, and set an `ignore` for the things to exclude.
+
+The comments feature is added in minimatch, primarily to more easily
+support use cases like ignore files, where a `#` at the start of a
+line makes the pattern "empty". However, in the context of a
+straightforward filesystem globber, "comments" don't make much sense.
+
+## Windows
+
+**Please only use forward-slashes in glob expressions.**
+
+Though windows uses either `/` or `\` as its path separator, only `/`
+characters are used by this glob implementation. You must use
+forward-slashes **only** in glob expressions. Back-slashes will always
+be interpreted as escape characters, not path separators.
+
+Results from absolute patterns such as `/foo/*` are mounted onto the
+root setting using `path.join`. On windows, this will by default result
+in `/foo/*` matching `C:\foo\bar.txt`.
+
+## Race Conditions
+
+Glob searching, by its very nature, is susceptible to race conditions,
+since it relies on directory walking and such.
+
+As a result, it is possible that a file that exists when glob looks for
+it may have been deleted or modified by the time it returns the result.
+
+As part of its internal implementation, this program caches all stat
+and readdir calls that it makes, in order to cut down on system
+overhead. However, this also makes it even more susceptible to races,
+especially if the cache or statCache objects are reused between glob
+calls.
+
+Users are thus advised not to use a glob result as a guarantee of
+filesystem state in the face of rapid changes. For the vast majority
+of operations, this is never a problem.
+
+## Contributing
+
+Any change to behavior (including bugfixes) must come with a test.
+
+Patches that fail tests or reduce performance will be rejected.
+
+```
+# to run tests
+npm test
+
+# to re-generate test fixtures
+npm run test-regen
+
+# to benchmark against bash/zsh
+npm run bench
+
+# to profile javascript
+npm run prof
+```
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/42cbe9fd/node_modules/glob/common.js
----------------------------------------------------------------------
diff --git a/node_modules/glob/common.js b/node_modules/glob/common.js
new file mode 100644
index 0000000..e36a631
--- /dev/null
+++ b/node_modules/glob/common.js
@@ -0,0 +1,245 @@
+exports.alphasort = alphasort
+exports.alphasorti = alphasorti
+exports.setopts = setopts
+exports.ownProp = ownProp
+exports.makeAbs = makeAbs
+exports.finish = finish
+exports.mark = mark
+exports.isIgnored = isIgnored
+exports.childrenIgnored = childrenIgnored
+
+function ownProp (obj, field) {
+ return Object.prototype.hasOwnProperty.call(obj, field)
+}
+
+var path = require("path")
+var minimatch = require("minimatch")
+var isAbsolute = require("path-is-absolute")
+var Minimatch = minimatch.Minimatch
+
+function alphasorti (a, b) {
+ return a.toLowerCase().localeCompare(b.toLowerCase())
+}
+
+function alphasort (a, b) {
+ return a.localeCompare(b)
+}
+
+function setupIgnores (self, options) {
+ self.ignore = options.ignore || []
+
+ if (!Array.isArray(self.ignore))
+ self.ignore = [self.ignore]
+
+ if (self.ignore.length) {
+ self.ignore = self.ignore.map(ignoreMap)
+ }
+}
+
+function ignoreMap (pattern) {
+ var gmatcher = null
+ if (pattern.slice(-3) === '/**') {
+ var gpattern = pattern.replace(/(\/\*\*)+$/, '')
+ gmatcher = new Minimatch(gpattern)
+ }
+
+ return {
+ matcher: new Minimatch(pattern),
+ gmatcher: gmatcher
+ }
+}
+
+function setopts (self, pattern, options) {
+ if (!options)
+ options = {}
+
+ // base-matching: just use globstar for that.
+ if (options.matchBase && -1 === pattern.indexOf("/")) {
+ if (options.noglobstar) {
+ throw new Error("base matching requires globstar")
+ }
+ pattern = "**/" + pattern
+ }
+
+ self.silent = !!options.silent
+ self.pattern = pattern
+ self.strict = options.strict !== false
+ self.realpath = !!options.realpath
+ self.realpathCache = options.realpathCache || Object.create(null)
+ self.follow = !!options.follow
+ self.dot = !!options.dot
+ self.mark = !!options.mark
+ self.nodir = !!options.nodir
+ if (self.nodir)
+ self.mark = true
+ self.sync = !!options.sync
+ self.nounique = !!options.nounique
+ self.nonull = !!options.nonull
+ self.nosort = !!options.nosort
+ self.nocase = !!options.nocase
+ self.stat = !!options.stat
+ self.noprocess = !!options.noprocess
+
+ self.maxLength = options.maxLength || Infinity
+ self.cache = options.cache || Object.create(null)
+ self.statCache = options.statCache || Object.create(null)
+ self.symlinks = options.symlinks || Object.create(null)
+
+ setupIgnores(self, options)
+
+ self.changedCwd = false
+ var cwd = process.cwd()
+ if (!ownProp(options, "cwd"))
+ self.cwd = cwd
+ else {
+ self.cwd = options.cwd
+ self.changedCwd = path.resolve(options.cwd) !== cwd
+ }
+
+ self.root = options.root || path.resolve(self.cwd, "/")
+ self.root = path.resolve(self.root)
+ if (process.platform === "win32")
+ self.root = self.root.replace(/\\/g, "/")
+
+ self.nomount = !!options.nomount
+
+ // disable comments and negation unless the user explicitly
+ // passes in false as the option.
+ options.nonegate = options.nonegate === false ? false : true
+ options.nocomment = options.nocomment === false ? false : true
+ deprecationWarning(options)
+
+ self.minimatch = new Minimatch(pattern, options)
+ self.options = self.minimatch.options
+}
+
+// TODO(isaacs): remove entirely in v6
+// exported to reset in tests
+exports.deprecationWarned
+function deprecationWarning(options) {
+ if (!options.nonegate || !options.nocomment) {
+ if (process.noDeprecation !== true && !exports.deprecationWarned) {
+ var msg = 'glob WARNING: comments and negation will be disabled in v6'
+ if (process.throwDeprecation)
+ throw new Error(msg)
+ else if (process.traceDeprecation)
+ console.trace(msg)
+ else
+ console.error(msg)
+
+ exports.deprecationWarned = true
+ }
+ }
+}
+
+function finish (self) {
+ var nou = self.nounique
+ var all = nou ? [] : Object.create(null)
+
+ for (var i = 0, l = self.matches.length; i < l; i ++) {
+ var matches = self.matches[i]
+ if (!matches || Object.keys(matches).length === 0) {
+ if (self.nonull) {
+ // do like the shell, and spit out the literal glob
+ var literal = self.minimatch.globSet[i]
+ if (nou)
+ all.push(literal)
+ else
+ all[literal] = true
+ }
+ } else {
+ // had matches
+ var m = Object.keys(matches)
+ if (nou)
+ all.push.apply(all, m)
+ else
+ m.forEach(function (m) {
+ all[m] = true
+ })
+ }
+ }
+
+ if (!nou)
+ all = Object.keys(all)
+
+ if (!self.nosort)
+ all = all.sort(self.nocase ? alphasorti : alphasort)
+
+ // at *some* point we statted all of these
+ if (self.mark) {
+ for (var i = 0; i < all.length; i++) {
+ all[i] = self._mark(all[i])
+ }
+ if (self.nodir) {
+ all = all.filter(function (e) {
+ return !(/\/$/.test(e))
+ })
+ }
+ }
+
+ if (self.ignore.length)
+ all = all.filter(function(m) {
+ return !isIgnored(self, m)
+ })
+
+ self.found = all
+}
+
+function mark (self, p) {
+ var abs = makeAbs(self, p)
+ var c = self.cache[abs]
+ var m = p
+ if (c) {
+ var isDir = c === 'DIR' || Array.isArray(c)
+ var slash = p.slice(-1) === '/'
+
+ if (isDir && !slash)
+ m += '/'
+ else if (!isDir && slash)
+ m = m.slice(0, -1)
+
+ if (m !== p) {
+ var mabs = makeAbs(self, m)
+ self.statCache[mabs] = self.statCache[abs]
+ self.cache[mabs] = self.cache[abs]
+ }
+ }
+
+ return m
+}
+
+// lotta situps...
+function makeAbs (self, f) {
+ var abs = f
+ if (f.charAt(0) === '/') {
+ abs = path.join(self.root, f)
+ } else if (isAbsolute(f) || f === '') {
+ abs = f
+ } else if (self.changedCwd) {
+ abs = path.resolve(self.cwd, f)
+ } else {
+ abs = path.resolve(f)
+ }
+ return abs
+}
+
+
+// Return true, if pattern ends with globstar '**', for the accompanying parent directory.
+// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
+function isIgnored (self, path) {
+ if (!self.ignore.length)
+ return false
+
+ return self.ignore.some(function(item) {
+ return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
+ })
+}
+
+function childrenIgnored (self, path) {
+ if (!self.ignore.length)
+ return false
+
+ return self.ignore.some(function(item) {
+ return !!(item.gmatcher && item.gmatcher.match(path))
+ })
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org