Initial
This commit is contained in:
12
resources/app/node_modules/xml2js/Cakefile
generated
vendored
Normal file
12
resources/app/node_modules/xml2js/Cakefile
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{spawn, exec} = require 'child_process'
|
||||
|
||||
task 'build', 'continually build the JavaScript code', ->
|
||||
coffee = spawn 'coffee', ['-cw', '-o', 'lib', 'src']
|
||||
coffee.stdout.on 'data', (data) -> console.log data.toString().trim()
|
||||
|
||||
task 'doc', 'rebuild the Docco documentation', ->
|
||||
exec([
|
||||
'docco src/xml2js.coffee'
|
||||
].join(' && '), (err) ->
|
||||
throw err if err
|
||||
)
|
||||
19
resources/app/node_modules/xml2js/LICENSE
generated
vendored
Normal file
19
resources/app/node_modules/xml2js/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright 2010, 2011. 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.
|
||||
225
resources/app/node_modules/xml2js/lib/xml2js.js
generated
vendored
Normal file
225
resources/app/node_modules/xml2js/lib/xml2js.js
generated
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
// Generated by CoffeeScript 1.3.1
|
||||
(function() {
|
||||
var events, isEmpty, sax,
|
||||
__hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; },
|
||||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
|
||||
sax = require('sax');
|
||||
|
||||
events = require('events');
|
||||
|
||||
isEmpty = function(thing) {
|
||||
return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0;
|
||||
};
|
||||
|
||||
exports.defaults = {
|
||||
"0.1": {
|
||||
explicitCharkey: false,
|
||||
trim: true,
|
||||
normalize: true,
|
||||
attrkey: "@",
|
||||
charkey: "#",
|
||||
explicitArray: false,
|
||||
ignoreAttrs: false,
|
||||
mergeAttrs: false,
|
||||
explicitRoot: false,
|
||||
validator: null
|
||||
},
|
||||
"0.2": {
|
||||
explicitCharkey: false,
|
||||
trim: false,
|
||||
normalize: false,
|
||||
attrkey: "$",
|
||||
charkey: "_",
|
||||
explicitArray: true,
|
||||
ignoreAttrs: false,
|
||||
mergeAttrs: false,
|
||||
explicitRoot: true,
|
||||
validator: null
|
||||
}
|
||||
};
|
||||
|
||||
exports.ValidationError = (function(_super) {
|
||||
|
||||
__extends(ValidationError, _super);
|
||||
|
||||
ValidationError.name = 'ValidationError';
|
||||
|
||||
function ValidationError(message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
return ValidationError;
|
||||
|
||||
})(Error);
|
||||
|
||||
exports.Parser = (function(_super) {
|
||||
|
||||
__extends(Parser, _super);
|
||||
|
||||
Parser.name = 'Parser';
|
||||
|
||||
function Parser(opts) {
|
||||
this.parseString = __bind(this.parseString, this);
|
||||
|
||||
this.reset = __bind(this.reset, this);
|
||||
|
||||
var key, value, _ref;
|
||||
this.options = {};
|
||||
_ref = exports.defaults["0.1"];
|
||||
for (key in _ref) {
|
||||
if (!__hasProp.call(_ref, key)) continue;
|
||||
value = _ref[key];
|
||||
this.options[key] = value;
|
||||
}
|
||||
for (key in opts) {
|
||||
if (!__hasProp.call(opts, key)) continue;
|
||||
value = opts[key];
|
||||
this.options[key] = value;
|
||||
}
|
||||
this.reset();
|
||||
}
|
||||
|
||||
Parser.prototype.reset = function() {
|
||||
var attrkey, charkey, err, stack,
|
||||
_this = this;
|
||||
this.removeAllListeners();
|
||||
this.saxParser = sax.parser(true, {
|
||||
trim: false,
|
||||
normalize: false
|
||||
});
|
||||
err = false;
|
||||
this.saxParser.onerror = function(error) {
|
||||
if (!err) {
|
||||
err = true;
|
||||
return _this.emit("error", error);
|
||||
}
|
||||
};
|
||||
this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
|
||||
this.resultObject = null;
|
||||
stack = [];
|
||||
attrkey = this.options.attrkey;
|
||||
charkey = this.options.charkey;
|
||||
this.saxParser.onopentag = function(node) {
|
||||
var key, obj, _ref;
|
||||
obj = {};
|
||||
obj[charkey] = "";
|
||||
if (!_this.options.ignoreAttrs) {
|
||||
_ref = node.attributes;
|
||||
for (key in _ref) {
|
||||
if (!__hasProp.call(_ref, key)) continue;
|
||||
if (!(attrkey in obj) && !_this.options.mergeAttrs) {
|
||||
obj[attrkey] = {};
|
||||
}
|
||||
if (_this.options.mergeAttrs) {
|
||||
obj[key] = node.attributes[key];
|
||||
} else {
|
||||
obj[attrkey][key] = node.attributes[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
obj["#name"] = node.name;
|
||||
return stack.push(obj);
|
||||
};
|
||||
this.saxParser.onclosetag = function() {
|
||||
var node, nodeName, obj, old, s, xpath;
|
||||
obj = stack.pop();
|
||||
nodeName = obj["#name"];
|
||||
delete obj["#name"];
|
||||
s = stack[stack.length - 1];
|
||||
if (obj[charkey].match(/^\s*$/)) {
|
||||
delete obj[charkey];
|
||||
} else {
|
||||
if (_this.options.trim) {
|
||||
obj[charkey] = obj[charkey].trim();
|
||||
}
|
||||
if (_this.options.normalize) {
|
||||
obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
|
||||
}
|
||||
if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
|
||||
obj = obj[charkey];
|
||||
}
|
||||
}
|
||||
if (_this.options.emptyTag !== void 0 && isEmpty(obj)) {
|
||||
obj = _this.options.emptyTag;
|
||||
}
|
||||
if (_this.options.validator != null) {
|
||||
xpath = "/" + ((function() {
|
||||
var _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = stack.length; _i < _len; _i++) {
|
||||
node = stack[_i];
|
||||
_results.push(node["#name"]);
|
||||
}
|
||||
return _results;
|
||||
})()).concat(nodeName).join("/");
|
||||
obj = _this.options.validator(xpath, s && s[nodeName], obj);
|
||||
}
|
||||
if (stack.length > 0) {
|
||||
if (!_this.options.explicitArray) {
|
||||
if (!(nodeName in s)) {
|
||||
return s[nodeName] = obj;
|
||||
} else if (s[nodeName] instanceof Array) {
|
||||
return s[nodeName].push(obj);
|
||||
} else {
|
||||
old = s[nodeName];
|
||||
s[nodeName] = [old];
|
||||
return s[nodeName].push(obj);
|
||||
}
|
||||
} else {
|
||||
if (!(s[nodeName] instanceof Array)) {
|
||||
s[nodeName] = [];
|
||||
}
|
||||
return s[nodeName].push(obj);
|
||||
}
|
||||
} else {
|
||||
if (_this.options.explicitRoot) {
|
||||
old = obj;
|
||||
obj = {};
|
||||
obj[nodeName] = old;
|
||||
}
|
||||
_this.resultObject = obj;
|
||||
return _this.emit("end", _this.resultObject);
|
||||
}
|
||||
};
|
||||
return this.saxParser.ontext = this.saxParser.oncdata = function(text) {
|
||||
var s;
|
||||
s = stack[stack.length - 1];
|
||||
if (s) {
|
||||
return s[charkey] += text;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Parser.prototype.parseString = function(str, cb) {
|
||||
if ((cb != null) && typeof cb === "function") {
|
||||
this.on("end", function(result) {
|
||||
this.reset();
|
||||
return cb(null, result);
|
||||
});
|
||||
this.on("error", function(err) {
|
||||
this.reset();
|
||||
return cb(err);
|
||||
});
|
||||
}
|
||||
if (str.toString().trim() === '') {
|
||||
this.emit("end", null);
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
return this.saxParser.write(str.toString());
|
||||
} catch (ex) {
|
||||
if (ex instanceof exports.ValidationError) {
|
||||
return this.emit("error", ex.message);
|
||||
} else {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Parser;
|
||||
|
||||
})(events.EventEmitter);
|
||||
|
||||
}).call(this);
|
||||
23
resources/app/node_modules/xml2js/package.json
generated
vendored
Normal file
23
resources/app/node_modules/xml2js/package.json
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "xml2js",
|
||||
"description": "Simple XML to JavaScript object converter.",
|
||||
"homepage": "https://github.com/Leonidas-from-XIV/node-xml2js",
|
||||
"version": "0.1.14",
|
||||
"author": "Marek Kubica <marek@xivilization.net> (http://xivilization.net)",
|
||||
"main": "./lib/xml2js",
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Leonidas-from-XIV/node-xml2js.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"sax": ">=0.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"coffee-script": ">=1.0.1",
|
||||
"zap": ">=0.2.3",
|
||||
"docco": ">=0.3.0"
|
||||
}
|
||||
}
|
||||
173
resources/app/node_modules/xml2js/src/xml2js.coffee
generated
vendored
Normal file
173
resources/app/node_modules/xml2js/src/xml2js.coffee
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
sax = require 'sax'
|
||||
events = require 'events'
|
||||
|
||||
# Underscore has a nice function for this, but we try to go without dependencies
|
||||
isEmpty = (thing) ->
|
||||
return typeof thing is "object" && thing? && Object.keys(thing).length is 0
|
||||
|
||||
exports.defaults =
|
||||
"0.1":
|
||||
explicitCharkey: false
|
||||
trim: true
|
||||
# normalize implicates trimming, just so you know
|
||||
normalize: true
|
||||
# set default attribute object key
|
||||
attrkey: "@"
|
||||
# set default char object key
|
||||
charkey: "#"
|
||||
# always put child nodes in an array
|
||||
explicitArray: false
|
||||
# ignore all attributes regardless
|
||||
ignoreAttrs: false
|
||||
# merge attributes and child elements onto parent object. this may
|
||||
# cause collisions.
|
||||
mergeAttrs: false
|
||||
explicitRoot: false
|
||||
validator: null
|
||||
"0.2":
|
||||
explicitCharkey: false
|
||||
trim: false
|
||||
normalize: false
|
||||
attrkey: "$"
|
||||
charkey: "_"
|
||||
explicitArray: true
|
||||
ignoreAttrs: false
|
||||
mergeAttrs: false
|
||||
explicitRoot: true
|
||||
validator: null
|
||||
|
||||
class exports.ValidationError extends Error
|
||||
constructor: (message) ->
|
||||
@message = message
|
||||
|
||||
class exports.Parser extends events.EventEmitter
|
||||
constructor: (opts) ->
|
||||
# copy this versions default options
|
||||
@options = {}
|
||||
@options[key] = value for own key, value of exports.defaults["0.1"]
|
||||
# overwrite them with the specified options, if any
|
||||
@options[key] = value for own key, value of opts
|
||||
|
||||
@reset()
|
||||
|
||||
reset: =>
|
||||
# remove all previous listeners for events, to prevent event listener
|
||||
# accumulation
|
||||
@removeAllListeners()
|
||||
# make the SAX parser. tried trim and normalize, but they are not
|
||||
# very helpful
|
||||
@saxParser = sax.parser true, {
|
||||
trim: false,
|
||||
normalize: false
|
||||
}
|
||||
|
||||
# emit one error event if the sax parser fails. this is mostly a hack, but
|
||||
# the sax parser isn't state of the art either.
|
||||
err = false
|
||||
@saxParser.onerror = (error) =>
|
||||
if ! err
|
||||
err = true
|
||||
@emit "error", error
|
||||
|
||||
# always use the '#' key, even if there are no subkeys
|
||||
# setting this property by and is deprecated, yet still supported.
|
||||
# better pass it as explicitCharkey option to the constructor
|
||||
@EXPLICIT_CHARKEY = @options.explicitCharkey
|
||||
@resultObject = null
|
||||
stack = []
|
||||
# aliases, so we don't have to type so much
|
||||
attrkey = @options.attrkey
|
||||
charkey = @options.charkey
|
||||
|
||||
@saxParser.onopentag = (node) =>
|
||||
obj = {}
|
||||
obj[charkey] = ""
|
||||
unless @options.ignoreAttrs
|
||||
for own key of node.attributes
|
||||
if attrkey not of obj and not @options.mergeAttrs
|
||||
obj[attrkey] = {}
|
||||
if @options.mergeAttrs
|
||||
obj[key] = node.attributes[key]
|
||||
else
|
||||
obj[attrkey][key] = node.attributes[key]
|
||||
|
||||
# need a place to store the node name
|
||||
obj["#name"] = node.name
|
||||
stack.push obj
|
||||
|
||||
@saxParser.onclosetag = =>
|
||||
obj = stack.pop()
|
||||
nodeName = obj["#name"]
|
||||
delete obj["#name"]
|
||||
|
||||
s = stack[stack.length - 1]
|
||||
# remove the '#' key altogether if it's blank
|
||||
if obj[charkey].match(/^\s*$/)
|
||||
delete obj[charkey]
|
||||
else
|
||||
obj[charkey] = obj[charkey].trim() if @options.trim
|
||||
obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim() if @options.normalize
|
||||
# also do away with '#' key altogether, if there's no subkeys
|
||||
# unless EXPLICIT_CHARKEY is set
|
||||
if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY
|
||||
obj = obj[charkey]
|
||||
|
||||
if @options.emptyTag != undefined && isEmpty obj
|
||||
obj = @options.emptyTag
|
||||
|
||||
if @options.validator?
|
||||
xpath = "/" + (node["#name"] for node in stack).concat(nodeName).join("/")
|
||||
obj = @options.validator(xpath, s and s[nodeName], obj)
|
||||
|
||||
# check whether we closed all the open tags
|
||||
if stack.length > 0
|
||||
if not @options.explicitArray
|
||||
if nodeName not of s
|
||||
s[nodeName] = obj
|
||||
else if s[nodeName] instanceof Array
|
||||
s[nodeName].push obj
|
||||
else
|
||||
old = s[nodeName]
|
||||
s[nodeName] = [old]
|
||||
s[nodeName].push obj
|
||||
else
|
||||
if not (s[nodeName] instanceof Array)
|
||||
s[nodeName] = []
|
||||
s[nodeName].push obj
|
||||
else
|
||||
# if explicitRoot was specified, wrap stuff in the root tag name
|
||||
if @options.explicitRoot
|
||||
# avoid circular references
|
||||
old = obj
|
||||
obj = {}
|
||||
obj[nodeName] = old
|
||||
|
||||
@resultObject = obj
|
||||
@emit "end", @resultObject
|
||||
|
||||
@saxParser.ontext = @saxParser.oncdata = (text) =>
|
||||
s = stack[stack.length - 1]
|
||||
if s
|
||||
s[charkey] += text
|
||||
|
||||
parseString: (str, cb) =>
|
||||
if cb? and typeof cb is "function"
|
||||
@on "end", (result) ->
|
||||
@reset()
|
||||
cb null, result
|
||||
@on "error", (err) ->
|
||||
@reset()
|
||||
cb err
|
||||
|
||||
if str.toString().trim() is ''
|
||||
@emit "end", null
|
||||
return true
|
||||
|
||||
try
|
||||
@saxParser.write str.toString()
|
||||
catch ex
|
||||
if ex instanceof exports.ValidationError
|
||||
@emit("error", ex.message)
|
||||
else
|
||||
throw ex
|
||||
|
||||
Reference in New Issue
Block a user