You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2014/09/30 09:46:15 UTC
[29/38] CB-7666 Merge node_modules and move to package root
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/ls.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/ls.js b/node_modules/shelljs/src/ls.js
new file mode 100644
index 0000000..3345db4
--- /dev/null
+++ b/node_modules/shelljs/src/ls.js
@@ -0,0 +1,126 @@
+var path = require('path');
+var fs = require('fs');
+var common = require('./common');
+var _cd = require('./cd');
+var _pwd = require('./pwd');
+
+//@
+//@ ### ls([options ,] path [,path ...])
+//@ ### ls([options ,] path_array)
+//@ Available options:
+//@
+//@ + `-R`: recursive
+//@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ ls('projs/*.js');
+//@ ls('-R', '/users/me', '/tmp');
+//@ ls('-R', ['/users/me', '/tmp']); // same as above
+//@ ```
+//@
+//@ Returns array of files in the given path, or in current directory if no path provided.
+function _ls(options, paths) {
+ options = common.parseOptions(options, {
+ 'R': 'recursive',
+ 'A': 'all',
+ 'a': 'all_deprecated'
+ });
+
+ if (options.all_deprecated) {
+ // We won't support the -a option as it's hard to image why it's useful
+ // (it includes '.' and '..' in addition to '.*' files)
+ // For backwards compatibility we'll dump a deprecated message and proceed as before
+ common.log('ls: Option -a is deprecated. Use -A instead');
+ options.all = true;
+ }
+
+ if (!paths)
+ paths = ['.'];
+ else if (typeof paths === 'object')
+ paths = paths; // assume array
+ else if (typeof paths === 'string')
+ paths = [].slice.call(arguments, 1);
+
+ var list = [];
+
+ // Conditionally pushes file to list - returns true if pushed, false otherwise
+ // (e.g. prevents hidden files to be included unless explicitly told so)
+ function pushFile(file, query) {
+ // hidden file?
+ if (path.basename(file)[0] === '.') {
+ // not explicitly asking for hidden files?
+ if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1))
+ return false;
+ }
+
+ if (common.platform === 'win')
+ file = file.replace(/\\/g, '/');
+
+ list.push(file);
+ return true;
+ }
+
+ paths.forEach(function(p) {
+ if (fs.existsSync(p)) {
+ var stats = fs.statSync(p);
+ // Simple file?
+ if (stats.isFile()) {
+ pushFile(p, p);
+ return; // continue
+ }
+
+ // Simple dir?
+ if (stats.isDirectory()) {
+ // Iterate over p contents
+ fs.readdirSync(p).forEach(function(file) {
+ if (!pushFile(file, p))
+ return;
+
+ // Recursive?
+ if (options.recursive) {
+ var oldDir = _pwd();
+ _cd('', p);
+ if (fs.statSync(file).isDirectory())
+ list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*'));
+ _cd('', oldDir);
+ }
+ });
+ return; // continue
+ }
+ }
+
+ // p does not exist - possible wildcard present
+
+ var basename = path.basename(p);
+ var dirname = path.dirname(p);
+ // Wildcard present on an existing dir? (e.g. '/tmp/*.js')
+ if (basename.search(/\*/) > -1 && fs.existsSync(dirname) && fs.statSync(dirname).isDirectory) {
+ // Escape special regular expression chars
+ var regexp = basename.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g, '\\$1');
+ // Translates wildcard into regex
+ regexp = '^' + regexp.replace(/\*/g, '.*') + '$';
+ // Iterate over directory contents
+ fs.readdirSync(dirname).forEach(function(file) {
+ if (file.match(new RegExp(regexp))) {
+ if (!pushFile(path.normalize(dirname+'/'+file), basename))
+ return;
+
+ // Recursive?
+ if (options.recursive) {
+ var pp = dirname + '/' + file;
+ if (fs.lstatSync(pp).isDirectory())
+ list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*'));
+ } // recursive
+ } // if file matches
+ }); // forEach
+ return;
+ }
+
+ common.error('no such file or directory: ' + p, true);
+ });
+
+ return list;
+}
+module.exports = _ls;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/mkdir.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/mkdir.js b/node_modules/shelljs/src/mkdir.js
new file mode 100644
index 0000000..5a7088f
--- /dev/null
+++ b/node_modules/shelljs/src/mkdir.js
@@ -0,0 +1,68 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+// Recursively creates 'dir'
+function mkdirSyncRecursive(dir) {
+ var baseDir = path.dirname(dir);
+
+ // Base dir exists, no recursion necessary
+ if (fs.existsSync(baseDir)) {
+ fs.mkdirSync(dir, parseInt('0777', 8));
+ return;
+ }
+
+ // Base dir does not exist, go recursive
+ mkdirSyncRecursive(baseDir);
+
+ // Base dir created, can create dir
+ fs.mkdirSync(dir, parseInt('0777', 8));
+}
+
+//@
+//@ ### mkdir([options ,] dir [, dir ...])
+//@ ### mkdir([options ,] dir_array)
+//@ Available options:
+//@
+//@ + `p`: full path (will create intermediate dirs if necessary)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
+//@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
+//@ ```
+//@
+//@ Creates directories.
+function _mkdir(options, dirs) {
+ options = common.parseOptions(options, {
+ 'p': 'fullpath'
+ });
+ if (!dirs)
+ common.error('no paths given');
+
+ if (typeof dirs === 'string')
+ dirs = [].slice.call(arguments, 1);
+ // if it's array leave it as it is
+
+ dirs.forEach(function(dir) {
+ if (fs.existsSync(dir)) {
+ if (!options.fullpath)
+ common.error('path already exists: ' + dir, true);
+ return; // skip dir
+ }
+
+ // Base dir does not exist, and no -p option given
+ var baseDir = path.dirname(dir);
+ if (!fs.existsSync(baseDir) && !options.fullpath) {
+ common.error('no such file or directory: ' + baseDir, true);
+ return; // skip dir
+ }
+
+ if (options.fullpath)
+ mkdirSyncRecursive(dir);
+ else
+ fs.mkdirSync(dir, parseInt('0777', 8));
+ });
+} // mkdir
+module.exports = _mkdir;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/mv.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/mv.js b/node_modules/shelljs/src/mv.js
new file mode 100644
index 0000000..11f9607
--- /dev/null
+++ b/node_modules/shelljs/src/mv.js
@@ -0,0 +1,80 @@
+var fs = require('fs');
+var path = require('path');
+var common = require('./common');
+
+//@
+//@ ### mv(source [, source ...], dest')
+//@ ### mv(source_array, dest')
+//@ Available options:
+//@
+//@ + `f`: force
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ mv('-f', 'file', 'dir/');
+//@ mv('file1', 'file2', 'dir/');
+//@ mv(['file1', 'file2'], 'dir/'); // same as above
+//@ ```
+//@
+//@ Moves files. The wildcard `*` is accepted.
+function _mv(options, sources, dest) {
+ options = common.parseOptions(options, {
+ 'f': 'force'
+ });
+
+ // Get sources, dest
+ if (arguments.length < 3) {
+ common.error('missing <source> and/or <dest>');
+ } else if (arguments.length > 3) {
+ sources = [].slice.call(arguments, 1, arguments.length - 1);
+ dest = arguments[arguments.length - 1];
+ } else if (typeof sources === 'string') {
+ sources = [sources];
+ } else if ('length' in sources) {
+ sources = sources; // no-op for array
+ } else {
+ common.error('invalid arguments');
+ }
+
+ sources = common.expand(sources);
+
+ var exists = fs.existsSync(dest),
+ stats = exists && fs.statSync(dest);
+
+ // Dest is not existing dir, but multiple sources given
+ if ((!exists || !stats.isDirectory()) && sources.length > 1)
+ common.error('dest is not a directory (too many sources)');
+
+ // Dest is an existing file, but no -f given
+ if (exists && stats.isFile() && !options.force)
+ common.error('dest file already exists: ' + dest);
+
+ sources.forEach(function(src) {
+ if (!fs.existsSync(src)) {
+ common.error('no such file or directory: '+src, true);
+ return; // skip file
+ }
+
+ // If here, src exists
+
+ // When copying to '/path/dir':
+ // thisDest = '/path/dir/file1'
+ var thisDest = dest;
+ if (fs.existsSync(dest) && fs.statSync(dest).isDirectory())
+ thisDest = path.normalize(dest + '/' + path.basename(src));
+
+ if (fs.existsSync(thisDest) && !options.force) {
+ common.error('dest file already exists: ' + thisDest, true);
+ return; // skip file
+ }
+
+ if (path.resolve(src) === path.dirname(path.resolve(thisDest))) {
+ common.error('cannot move to self: '+src, true);
+ return; // skip file
+ }
+
+ fs.renameSync(src, thisDest);
+ }); // forEach(src)
+} // mv
+module.exports = _mv;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/popd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/popd.js b/node_modules/shelljs/src/popd.js
new file mode 100644
index 0000000..11ea24f
--- /dev/null
+++ b/node_modules/shelljs/src/popd.js
@@ -0,0 +1 @@
+// see dirs.js
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/pushd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/pushd.js b/node_modules/shelljs/src/pushd.js
new file mode 100644
index 0000000..11ea24f
--- /dev/null
+++ b/node_modules/shelljs/src/pushd.js
@@ -0,0 +1 @@
+// see dirs.js
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/pwd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/pwd.js b/node_modules/shelljs/src/pwd.js
new file mode 100644
index 0000000..41727bb
--- /dev/null
+++ b/node_modules/shelljs/src/pwd.js
@@ -0,0 +1,11 @@
+var path = require('path');
+var common = require('./common');
+
+//@
+//@ ### pwd()
+//@ Returns the current directory.
+function _pwd(options) {
+ var pwd = path.resolve(process.cwd());
+ return common.ShellString(pwd);
+}
+module.exports = _pwd;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/rm.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/rm.js b/node_modules/shelljs/src/rm.js
new file mode 100644
index 0000000..3abe6e1
--- /dev/null
+++ b/node_modules/shelljs/src/rm.js
@@ -0,0 +1,145 @@
+var common = require('./common');
+var fs = require('fs');
+
+// Recursively removes 'dir'
+// Adapted from https://github.com/ryanmcgrath/wrench-js
+//
+// Copyright (c) 2010 Ryan McGrath
+// Copyright (c) 2012 Artur Adib
+//
+// Licensed under the MIT License
+// http://www.opensource.org/licenses/mit-license.php
+function rmdirSyncRecursive(dir, force) {
+ var files;
+
+ files = fs.readdirSync(dir);
+
+ // Loop through and delete everything in the sub-tree after checking it
+ for(var i = 0; i < files.length; i++) {
+ var file = dir + "/" + files[i],
+ currFile = fs.lstatSync(file);
+
+ if(currFile.isDirectory()) { // Recursive function back to the beginning
+ rmdirSyncRecursive(file, force);
+ }
+
+ else if(currFile.isSymbolicLink()) { // Unlink symlinks
+ if (force || isWriteable(file)) {
+ try {
+ common.unlinkSync(file);
+ } catch (e) {
+ common.error('could not remove file (code '+e.code+'): ' + file, true);
+ }
+ }
+ }
+
+ else // Assume it's a file - perhaps a try/catch belongs here?
+ if (force || isWriteable(file)) {
+ try {
+ common.unlinkSync(file);
+ } catch (e) {
+ common.error('could not remove file (code '+e.code+'): ' + file, true);
+ }
+ }
+ }
+
+ // Now that we know everything in the sub-tree has been deleted, we can delete the main directory.
+ // Huzzah for the shopkeep.
+
+ var result;
+ try {
+ result = fs.rmdirSync(dir);
+ } catch(e) {
+ common.error('could not remove directory (code '+e.code+'): ' + dir, true);
+ }
+
+ return result;
+} // rmdirSyncRecursive
+
+// Hack to determine if file has write permissions for current user
+// Avoids having to check user, group, etc, but it's probably slow
+function isWriteable(file) {
+ var writePermission = true;
+ try {
+ var __fd = fs.openSync(file, 'a');
+ fs.closeSync(__fd);
+ } catch(e) {
+ writePermission = false;
+ }
+
+ return writePermission;
+}
+
+//@
+//@ ### rm([options ,] file [, file ...])
+//@ ### rm([options ,] file_array)
+//@ Available options:
+//@
+//@ + `-f`: force
+//@ + `-r, -R`: recursive
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ rm('-rf', '/tmp/*');
+//@ rm('some_file.txt', 'another_file.txt');
+//@ rm(['some_file.txt', 'another_file.txt']); // same as above
+//@ ```
+//@
+//@ Removes files. The wildcard `*` is accepted.
+function _rm(options, files) {
+ options = common.parseOptions(options, {
+ 'f': 'force',
+ 'r': 'recursive',
+ 'R': 'recursive'
+ });
+ if (!files)
+ common.error('no paths given');
+
+ if (typeof files === 'string')
+ files = [].slice.call(arguments, 1);
+ // if it's array leave it as it is
+
+ files = common.expand(files);
+
+ files.forEach(function(file) {
+ if (!fs.existsSync(file)) {
+ // Path does not exist, no force flag given
+ if (!options.force)
+ common.error('no such file or directory: '+file, true);
+
+ return; // skip file
+ }
+
+ // If here, path exists
+
+ var stats = fs.lstatSync(file);
+ if (stats.isFile() || stats.isSymbolicLink()) {
+
+ // Do not check for file writing permissions
+ if (options.force) {
+ common.unlinkSync(file);
+ return;
+ }
+
+ if (isWriteable(file))
+ common.unlinkSync(file);
+ else
+ common.error('permission denied: '+file, true);
+
+ return;
+ } // simple file
+
+ // Path is an existing directory, but no -r flag given
+ if (stats.isDirectory() && !options.recursive) {
+ common.error('path is a directory', true);
+ return; // skip path
+ }
+
+ // Recursively remove existing directory
+ if (stats.isDirectory() && options.recursive) {
+ rmdirSyncRecursive(file, options.force);
+ }
+ }); // forEach(file)
+} // rm
+module.exports = _rm;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/sed.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/sed.js b/node_modules/shelljs/src/sed.js
new file mode 100644
index 0000000..65f7cb4
--- /dev/null
+++ b/node_modules/shelljs/src/sed.js
@@ -0,0 +1,43 @@
+var common = require('./common');
+var fs = require('fs');
+
+//@
+//@ ### sed([options ,] search_regex, replacement, file)
+//@ Available options:
+//@
+//@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
+//@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
+//@ ```
+//@
+//@ Reads an input string from `file` and performs a JavaScript `replace()` on the input
+//@ using the given search regex and replacement string or function. Returns the new string after replacement.
+function _sed(options, regex, replacement, file) {
+ options = common.parseOptions(options, {
+ 'i': 'inplace'
+ });
+
+ if (typeof replacement === 'string' || typeof replacement === 'function')
+ replacement = replacement; // no-op
+ else if (typeof replacement === 'number')
+ replacement = replacement.toString(); // fallback
+ else
+ common.error('invalid replacement string');
+
+ if (!file)
+ common.error('no file given');
+
+ if (!fs.existsSync(file))
+ common.error('no such file or directory: ' + file);
+
+ var result = fs.readFileSync(file, 'utf8').replace(regex, replacement);
+ if (options.inplace)
+ fs.writeFileSync(file, result, 'utf8');
+
+ return common.ShellString(result);
+}
+module.exports = _sed;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/tempdir.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/tempdir.js b/node_modules/shelljs/src/tempdir.js
new file mode 100644
index 0000000..45953c2
--- /dev/null
+++ b/node_modules/shelljs/src/tempdir.js
@@ -0,0 +1,56 @@
+var common = require('./common');
+var os = require('os');
+var fs = require('fs');
+
+// Returns false if 'dir' is not a writeable directory, 'dir' otherwise
+function writeableDir(dir) {
+ if (!dir || !fs.existsSync(dir))
+ return false;
+
+ if (!fs.statSync(dir).isDirectory())
+ return false;
+
+ var testFile = dir+'/'+common.randomFileName();
+ try {
+ fs.writeFileSync(testFile, ' ');
+ common.unlinkSync(testFile);
+ return dir;
+ } catch (e) {
+ return false;
+ }
+}
+
+
+//@
+//@ ### tempdir()
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ var tmp = tempdir(); // "/tmp" for most *nix platforms
+//@ ```
+//@
+//@ Searches and returns string containing a writeable, platform-dependent temporary directory.
+//@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
+function _tempDir() {
+ var state = common.state;
+ if (state.tempDir)
+ return state.tempDir; // from cache
+
+ state.tempDir = writeableDir(os.tempDir && os.tempDir()) || // node 0.8+
+ writeableDir(process.env['TMPDIR']) ||
+ writeableDir(process.env['TEMP']) ||
+ writeableDir(process.env['TMP']) ||
+ writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS
+ writeableDir('C:\\TEMP') || // Windows
+ writeableDir('C:\\TMP') || // Windows
+ writeableDir('\\TEMP') || // Windows
+ writeableDir('\\TMP') || // Windows
+ writeableDir('/tmp') ||
+ writeableDir('/var/tmp') ||
+ writeableDir('/usr/tmp') ||
+ writeableDir('.'); // last resort
+
+ return state.tempDir;
+}
+module.exports = _tempDir;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/test.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/test.js b/node_modules/shelljs/src/test.js
new file mode 100644
index 0000000..8a4ac7d
--- /dev/null
+++ b/node_modules/shelljs/src/test.js
@@ -0,0 +1,85 @@
+var common = require('./common');
+var fs = require('fs');
+
+//@
+//@ ### test(expression)
+//@ Available expression primaries:
+//@
+//@ + `'-b', 'path'`: true if path is a block device
+//@ + `'-c', 'path'`: true if path is a character device
+//@ + `'-d', 'path'`: true if path is a directory
+//@ + `'-e', 'path'`: true if path exists
+//@ + `'-f', 'path'`: true if path is a regular file
+//@ + `'-L', 'path'`: true if path is a symboilc link
+//@ + `'-p', 'path'`: true if path is a pipe (FIFO)
+//@ + `'-S', 'path'`: true if path is a socket
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ if (test('-d', path)) { /* do something with dir */ };
+//@ if (!test('-f', path)) continue; // skip if it's a regular file
+//@ ```
+//@
+//@ Evaluates expression using the available primaries and returns corresponding value.
+function _test(options, path) {
+ if (!path)
+ common.error('no path given');
+
+ // hack - only works with unary primaries
+ options = common.parseOptions(options, {
+ 'b': 'block',
+ 'c': 'character',
+ 'd': 'directory',
+ 'e': 'exists',
+ 'f': 'file',
+ 'L': 'link',
+ 'p': 'pipe',
+ 'S': 'socket'
+ });
+
+ var canInterpret = false;
+ for (var key in options)
+ if (options[key] === true) {
+ canInterpret = true;
+ break;
+ }
+
+ if (!canInterpret)
+ common.error('could not interpret expression');
+
+ if (options.link) {
+ try {
+ return fs.lstatSync(path).isSymbolicLink();
+ } catch(e) {
+ return false;
+ }
+ }
+
+ if (!fs.existsSync(path))
+ return false;
+
+ if (options.exists)
+ return true;
+
+ var stats = fs.statSync(path);
+
+ if (options.block)
+ return stats.isBlockDevice();
+
+ if (options.character)
+ return stats.isCharacterDevice();
+
+ if (options.directory)
+ return stats.isDirectory();
+
+ if (options.file)
+ return stats.isFile();
+
+ if (options.pipe)
+ return stats.isFIFO();
+
+ if (options.socket)
+ return stats.isSocket();
+} // test
+module.exports = _test;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/to.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/to.js b/node_modules/shelljs/src/to.js
new file mode 100644
index 0000000..f029999
--- /dev/null
+++ b/node_modules/shelljs/src/to.js
@@ -0,0 +1,29 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+//@
+//@ ### 'string'.to(file)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ cat('input.txt').to('output.txt');
+//@ ```
+//@
+//@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as
+//@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_
+function _to(options, file) {
+ if (!file)
+ common.error('wrong arguments');
+
+ if (!fs.existsSync( path.dirname(file) ))
+ common.error('no such file or directory: ' + path.dirname(file));
+
+ try {
+ fs.writeFileSync(file, this.toString(), 'utf8');
+ } catch(e) {
+ common.error('could not write to file (code '+e.code+'): '+file, true);
+ }
+}
+module.exports = _to;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/toEnd.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/toEnd.js b/node_modules/shelljs/src/toEnd.js
new file mode 100644
index 0000000..f6d099d
--- /dev/null
+++ b/node_modules/shelljs/src/toEnd.js
@@ -0,0 +1,29 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+//@
+//@ ### 'string'.toEnd(file)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ cat('input.txt').toEnd('output.txt');
+//@ ```
+//@
+//@ Analogous to the redirect-and-append operator `>>` in Unix, but works with JavaScript strings (such as
+//@ those returned by `cat`, `grep`, etc).
+function _toEnd(options, file) {
+ if (!file)
+ common.error('wrong arguments');
+
+ if (!fs.existsSync( path.dirname(file) ))
+ common.error('no such file or directory: ' + path.dirname(file));
+
+ try {
+ fs.appendFileSync(file, this.toString(), 'utf8');
+ } catch(e) {
+ common.error('could not append to file (code '+e.code+'): '+file, true);
+ }
+}
+module.exports = _toEnd;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/node_modules/shelljs/src/which.js
----------------------------------------------------------------------
diff --git a/node_modules/shelljs/src/which.js b/node_modules/shelljs/src/which.js
new file mode 100644
index 0000000..2822ecf
--- /dev/null
+++ b/node_modules/shelljs/src/which.js
@@ -0,0 +1,83 @@
+var common = require('./common');
+var fs = require('fs');
+var path = require('path');
+
+// Cross-platform method for splitting environment PATH variables
+function splitPath(p) {
+ for (i=1;i<2;i++) {}
+
+ if (!p)
+ return [];
+
+ if (common.platform === 'win')
+ return p.split(';');
+ else
+ return p.split(':');
+}
+
+function checkPath(path) {
+ return fs.existsSync(path) && fs.statSync(path).isDirectory() == false;
+}
+
+//@
+//@ ### which(command)
+//@
+//@ Examples:
+//@
+//@ ```javascript
+//@ var nodeExec = which('node');
+//@ ```
+//@
+//@ Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.
+//@ Returns string containing the absolute path to the command.
+function _which(options, cmd) {
+ if (!cmd)
+ common.error('must specify command');
+
+ var pathEnv = process.env.path || process.env.Path || process.env.PATH,
+ pathArray = splitPath(pathEnv),
+ where = null;
+
+ // No relative/absolute paths provided?
+ if (cmd.search(/\//) === -1) {
+ // Search for command in PATH
+ pathArray.forEach(function(dir) {
+ if (where)
+ return; // already found it
+
+ var attempt = path.resolve(dir + '/' + cmd);
+ if (checkPath(attempt)) {
+ where = attempt;
+ return;
+ }
+
+ if (common.platform === 'win') {
+ var baseAttempt = attempt;
+ attempt = baseAttempt + '.exe';
+ if (checkPath(attempt)) {
+ where = attempt;
+ return;
+ }
+ attempt = baseAttempt + '.cmd';
+ if (checkPath(attempt)) {
+ where = attempt;
+ return;
+ }
+ attempt = baseAttempt + '.bat';
+ if (checkPath(attempt)) {
+ where = attempt;
+ return;
+ }
+ } // if 'win'
+ });
+ }
+
+ // Command not found anywhere?
+ if (!checkPath(cmd) && !where)
+ return null;
+
+ where = where || path.resolve(cmd);
+
+ return common.ShellString(where);
+}
+module.exports = _which;
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index e8cd820..2cedfee 100644
--- a/package.json
+++ b/package.json
@@ -13,11 +13,19 @@
"apache"
],
"dependencies": {
- "q": "^0.9.0",
+ "q": ">0.9.0",
"nopt": "~3",
"node-uuid": "~1.4",
- "shelljs": "~0.3"
+ "shelljs": "~0.3",
+ "elementtree": "~0.1.5"
},
+ "bundledDependencies": [
+ "q",
+ "nopt",
+ "node-uuid",
+ "shelljs",
+ "elementtree"
+ ],
"scripts": {
"test": "bin\\create .\\testcreate & .\\testcreate\\cordova\\build & rm -rf .\\testcreate"
},
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/.bin/nopt
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/.bin/nopt b/template/cordova/node_modules/.bin/nopt
deleted file mode 100644
index 25995f3..0000000
--- a/template/cordova/node_modules/.bin/nopt
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-basedir=`dirname "$0"`
-
-case `uname` in
- *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
-esac
-
-if [ -x "$basedir/node" ]; then
- "$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
- ret=$?
-else
- node "$basedir/../nopt/bin/nopt.js" "$@"
- ret=$?
-fi
-exit $ret
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/.bin/nopt.cmd
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/.bin/nopt.cmd b/template/cordova/node_modules/.bin/nopt.cmd
deleted file mode 100644
index c8e8216..0000000
--- a/template/cordova/node_modules/.bin/nopt.cmd
+++ /dev/null
@@ -1,5 +0,0 @@
-@IF EXIST "%~dp0\node.exe" (
- "%~dp0\node.exe" "%~dp0\..\nopt\bin\nopt.js" %*
-) ELSE (
- node "%~dp0\..\nopt\bin\nopt.js" %*
-)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/elementtree/.npmignore
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/.npmignore b/template/cordova/node_modules/elementtree/.npmignore
deleted file mode 100644
index 3c3629e..0000000
--- a/template/cordova/node_modules/elementtree/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/elementtree/.travis.yml
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/.travis.yml b/template/cordova/node_modules/elementtree/.travis.yml
deleted file mode 100644
index 6f27c96..0000000
--- a/template/cordova/node_modules/elementtree/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-language: node_js
-
-node_js:
- - 0.6
-
-script: make test
-
-notifications:
- email:
- - tomaz+travisci@tomaz.me
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/elementtree/CHANGES.md
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/CHANGES.md b/template/cordova/node_modules/elementtree/CHANGES.md
deleted file mode 100644
index 83bd61b..0000000
--- a/template/cordova/node_modules/elementtree/CHANGES.md
+++ /dev/null
@@ -1,34 +0,0 @@
-elementtree v0.1.5 (in development)
-
-* Fix a bug in the find() and findtext() method which could manifest itself
- under some conditions.
- [metagriffin]
-
-elementtree v0.1.4
-
-* Allow user to use namespaced attributes when using find* functions.
- [Andrew Lunny]
-
-elementtree v0.1.3
-
-* Improve the output of text content in the tags (strip unnecessary line break
- characters).
-
-[Darryl Pogue]
-
-elementtree v0.1.2
-
- * Allow user to pass 'indent' option to ElementTree.write method. If this
- option is specified (e.g. {'indent': 4}). XML will be pretty printed.
- [Darryl Pogue, Tomaz Muraus]
-
- * Bump sax dependency version.
-
-elementtree v0.1.1 - 2011-09-23
-
- * Improve special character escaping.
- [Ryan Phillips]
-
-elementtree v0.1.0 - 2011-09-05
-
- * Initial release.
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/elementtree/LICENSE.txt
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/LICENSE.txt b/template/cordova/node_modules/elementtree/LICENSE.txt
deleted file mode 100644
index 6b0b127..0000000
--- a/template/cordova/node_modules/elementtree/LICENSE.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
-
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/elementtree/Makefile
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/Makefile b/template/cordova/node_modules/elementtree/Makefile
deleted file mode 100644
index ab7c4e0..0000000
--- a/template/cordova/node_modules/elementtree/Makefile
+++ /dev/null
@@ -1,21 +0,0 @@
-TESTS := \
- tests/test-simple.js
-
-
-
-PATH := ./node_modules/.bin:$(PATH)
-
-WHISKEY := $(shell bash -c 'PATH=$(PATH) type -p whiskey')
-
-default: test
-
-test:
- NODE_PATH=`pwd`/lib/ ${WHISKEY} --scope-leaks --sequential --real-time --tests "${TESTS}"
-
-tap:
- NODE_PATH=`pwd`/lib/ ${WHISKEY} --test-reporter tap --sequential --real-time --tests "${TESTS}"
-
-coverage:
- NODE_PATH=`pwd`/lib/ ${WHISKEY} --sequential --coverage --coverage-reporter html --coverage-dir coverage_html --tests "${TESTS}"
-
-.PHONY: default test coverage tap scope
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/elementtree/NOTICE
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/NOTICE b/template/cordova/node_modules/elementtree/NOTICE
deleted file mode 100644
index 28ad70a..0000000
--- a/template/cordova/node_modules/elementtree/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-node-elementtree
-Copyright (c) 2011, Rackspace, Inc.
-
-The ElementTree toolkit is Copyright (c) 1999-2007 by Fredrik Lundh
-
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/elementtree/README.md
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/README.md b/template/cordova/node_modules/elementtree/README.md
deleted file mode 100644
index 8a7e710..0000000
--- a/template/cordova/node_modules/elementtree/README.md
+++ /dev/null
@@ -1,27 +0,0 @@
-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).
-
-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-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/constants.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/constants.js b/template/cordova/node_modules/elementtree/lib/constants.js
deleted file mode 100644
index b057faf..0000000
--- a/template/cordova/node_modules/elementtree/lib/constants.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/elementpath.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/elementpath.js b/template/cordova/node_modules/elementtree/lib/elementpath.js
deleted file mode 100644
index 2e93f47..0000000
--- a/template/cordova/node_modules/elementtree/lib/elementpath.js
+++ /dev/null
@@ -1,343 +0,0 @@
-/**
- * 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-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/elementtree.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/elementtree.js b/template/cordova/node_modules/elementtree/lib/elementtree.js
deleted file mode 100644
index b46268c..0000000
--- a/template/cordova/node_modules/elementtree/lib/elementtree.js
+++ /dev/null
@@ -1,598 +0,0 @@
-/**
- * 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(index, 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 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 !== 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 {
- 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.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-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/errors.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/errors.js b/template/cordova/node_modules/elementtree/lib/errors.js
deleted file mode 100644
index e8742be..0000000
--- a/template/cordova/node_modules/elementtree/lib/errors.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/parser.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/parser.js b/template/cordova/node_modules/elementtree/lib/parser.js
deleted file mode 100644
index 7307ee4..0000000
--- a/template/cordova/node_modules/elementtree/lib/parser.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/parsers/index.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/parsers/index.js b/template/cordova/node_modules/elementtree/lib/parsers/index.js
deleted file mode 100644
index 5eac5c8..0000000
--- a/template/cordova/node_modules/elementtree/lib/parsers/index.js
+++ /dev/null
@@ -1 +0,0 @@
-exports.sax = require('./sax');
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/parsers/sax.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/parsers/sax.js b/template/cordova/node_modules/elementtree/lib/parsers/sax.js
deleted file mode 100644
index 69b0a59..0000000
--- a/template/cordova/node_modules/elementtree/lib/parsers/sax.js
+++ /dev/null
@@ -1,56 +0,0 @@
-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-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/sprintf.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/sprintf.js b/template/cordova/node_modules/elementtree/lib/sprintf.js
deleted file mode 100644
index f802c1b..0000000
--- a/template/cordova/node_modules/elementtree/lib/sprintf.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/treebuilder.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/treebuilder.js b/template/cordova/node_modules/elementtree/lib/treebuilder.js
deleted file mode 100644
index 393a98f..0000000
--- a/template/cordova/node_modules/elementtree/lib/treebuilder.js
+++ /dev/null
@@ -1,60 +0,0 @@
-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-windows/blob/52c99052/template/cordova/node_modules/elementtree/lib/utils.js
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/lib/utils.js b/template/cordova/node_modules/elementtree/lib/utils.js
deleted file mode 100644
index b08a670..0000000
--- a/template/cordova/node_modules/elementtree/lib/utils.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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-windows/blob/52c99052/template/cordova/node_modules/elementtree/node_modules/sax/AUTHORS
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/node_modules/sax/AUTHORS b/template/cordova/node_modules/elementtree/node_modules/sax/AUTHORS
deleted file mode 100644
index 26d8659..0000000
--- a/template/cordova/node_modules/elementtree/node_modules/sax/AUTHORS
+++ /dev/null
@@ -1,9 +0,0 @@
-# contributors sorted by whether or not they're me.
-Isaac Z. Schlueter <i...@izs.me>
-Stein Martin Hustad <st...@hustad.com>
-Mikeal Rogers <mi...@gmail.com>
-Laurie Harper <la...@holoweb.net>
-Jann Horn <ja...@Jann-PC.fritz.box>
-Elijah Insua <tm...@gmail.com>
-Henry Rawas <he...@schakra.com>
-Justin Makeig <jm...@makeig.com>
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/52c99052/template/cordova/node_modules/elementtree/node_modules/sax/LICENSE
----------------------------------------------------------------------
diff --git a/template/cordova/node_modules/elementtree/node_modules/sax/LICENSE b/template/cordova/node_modules/elementtree/node_modules/sax/LICENSE
deleted file mode 100644
index 05a4010..0000000
--- a/template/cordova/node_modules/elementtree/node_modules/sax/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.