NPM Dependencies UPDATE

This commit is contained in:
Luis Fernando Molina committed 2018-05-02 10:22:14 +02:00
1 parent d3bc5e34f6
commit 5bfb4ff32a
732 files changed
+13367 -62155

No files matched your search

-12
View File
@@ -1,12 +0,0 @@
{
"name": "sax",
"description": "An evented streaming XML parser in JavaScript",
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"version": "0.5.2",
"main": "lib/sax.js",
"license": "BSD",
"scripts": [
"lib/sax.js"
],
"repository": "git://github.com/isaacs/sax-js.git"
}
+45
View File
@@ -0,0 +1,45 @@
#!/usr/local/bin/node-bench
var Promise = require("events").Promise;
var xml = require("posix").cat("test.xml").wait(),
path = require("path"),
sax = require("../lib/sax"),
saxT = require("../lib/sax-trampoline"),
parser = sax.parser(false, {trim:true}),
parserT = saxT.parser(false, {trim:true}),
sys = require("sys");
var count = exports.stepsPerLap = 500,
l = xml.length,
runs = 0;
exports.countPerLap = 1000;
exports.compare = {
"switch" : function () {
// sys.debug("switch runs: "+runs++);
// for (var x = 0; x < l; x += 1000) {
// parser.write(xml.substr(x, 1000))
// }
// for (var i = 0; i < count; i ++) {
parser.write(xml);
parser.close();
// }
// done();
},
trampoline : function () {
// sys.debug("trampoline runs: "+runs++);
// for (var x = 0; x < l; x += 1000) {
// parserT.write(xml.substr(x, 1000))
// }
// for (var i = 0; i < count; i ++) {
parserT.write(xml);
parserT.close();
// }
// done();
},
};
sys.debug("rock and roll...");
+10 -50
View File
@@ -133,24 +133,11 @@ function clearBuffers (parser) {
}
}
function flushBuffers (parser) {
closeText(parser)
if (parser.cdata !== "") {
emitNode(parser, "oncdata", parser.cdata)
parser.cdata = ""
}
if (parser.script !== "") {
emitNode(parser, "onscript", parser.script)
parser.script = ""
}
}
SAXParser.prototype =
{ end: function () { end(this) }
, write: write
, resume: function () { this.error = null; return this }
, close: function () { return this.write(null) }
, flush: function () { flushBuffers(this) }
}
try {
@@ -192,8 +179,6 @@ function SAXStream (strict, opt) {
me._parser.error = null
}
this._decoder = null;
streamWraps.forEach(function (ev) {
Object.defineProperty(me, "on" + ev, {
get: function () { return me._parser["on" + ev] },
@@ -214,23 +199,13 @@ SAXStream.prototype = Object.create(Stream.prototype,
{ constructor: { value: SAXStream } })
SAXStream.prototype.write = function (data) {
if (typeof Buffer === 'function' &&
typeof Buffer.isBuffer === 'function' &&
Buffer.isBuffer(data)) {
if (!this._decoder) {
var SD = require('string_decoder').StringDecoder
this._decoder = new SD('utf8')
}
data = this._decoder.write(data);
}
this._parser.write(data.toString())
this.emit("data", data)
return true
}
SAXStream.prototype.end = function (chunk) {
if (chunk && chunk.length) this.write(chunk)
if (chunk && chunk.length) this._parser.write(chunk.toString())
this._parser.end()
return true
}
@@ -334,7 +309,6 @@ sax.STATE =
, ATTRIB_NAME_SAW_WHITE : S++ // <a foo _
, ATTRIB_VALUE : S++ // <a foo=
, ATTRIB_VALUE_QUOTED : S++ // <a foo="bar
, ATTRIB_VALUE_CLOSED : S++ // <a foo="bar"
, ATTRIB_VALUE_UNQUOTED : S++ // <a foo=bar
, ATTRIB_VALUE_ENTITY_Q : S++ // <foo bar="&quot;"
, ATTRIB_VALUE_ENTITY_U : S++ // <foo bar=&quot;
@@ -647,7 +621,7 @@ function error (parser, er) {
function end (parser) {
if (!parser.closedRoot) strictFail(parser, "Unclosed root tag")
if ((parser.state !== S.BEGIN) && (parser.state !== S.TEXT)) error(parser, "Unexpected end")
if (parser.state !== S.TEXT) error(parser, "Unexpected end")
closeText(parser)
parser.c = ""
parser.closed = true
@@ -672,14 +646,14 @@ function newTag (parser) {
parser.attribList.length = 0
}
function qname (name, attribute) {
function qname (name) {
var i = name.indexOf(":")
, qualName = i < 0 ? [ "", name ] : name.split(":")
, prefix = qualName[0]
, local = qualName[1]
// <x "xmlns"="http://foo">
if (attribute && name === "xmlns") {
if (name === "xmlns") {
prefix = "xmlns"
local = ""
}
@@ -690,13 +664,13 @@ function qname (name, attribute) {
function attrib (parser) {
if (!parser.strict) parser.attribName = parser.attribName[parser.looseCase]()
if (parser.attribList.indexOf(parser.attribName) !== -1 ||
if (parser.attribList.hasOwnProperty(parser.attribName) ||
parser.tag.attributes.hasOwnProperty(parser.attribName)) {
return parser.attribName = parser.attribValue = ""
return parser.attribName = parser.attribValue = ""
}
if (parser.opt.xmlns) {
var qn = qname(parser.attribName, true)
var qn = qname(parser.attribName)
, prefix = qn.prefix
, local = qn.local
@@ -745,12 +719,11 @@ function openTag (parser, selfClosing) {
var qn = qname(parser.tagName)
tag.prefix = qn.prefix
tag.local = qn.local
tag.uri = tag.ns[qn.prefix] || ""
tag.uri = tag.ns[qn.prefix] || qn.prefix
if (tag.prefix && !tag.uri) {
strictFail(parser, "Unbound namespace prefix: "
+ JSON.stringify(parser.tagName))
tag.uri = qn.prefix
}
var parent = parser.tags[parser.tags.length - 1] || parser
@@ -769,7 +742,7 @@ function openTag (parser, selfClosing) {
var nv = parser.attribList[i]
var name = nv[0]
, value = nv[1]
, qualName = qname(name, true)
, qualName = qname(name)
, prefix = qualName.prefix
, local = qualName.local
, uri = prefix == "" ? "" : (tag.ns[prefix] || "")
@@ -1251,20 +1224,7 @@ function write (chunk) {
}
attrib(parser)
parser.q = ""
parser.state = S.ATTRIB_VALUE_CLOSED
continue
case S.ATTRIB_VALUE_CLOSED:
if (is(whitespace, c)) {
parser.state = S.ATTRIB
} else if (c === ">") openTag(parser)
else if (c === "/") parser.state = S.OPEN_TAG_SLASH
else if (is(nameStart, c)) {
strictFail(parser, "No whitespace between attributes")
parser.attribName = c
parser.attribValue = ""
parser.state = S.ATTRIB_NAME
} else strictFail(parser, "Invalid attribute name")
parser.state = S.ATTRIB
continue
case S.ATTRIB_VALUE_UNQUOTED:
+20 -39
View File
@@ -1,39 +1,35 @@
{
"_args": [
[
"sax@0.5.x",
"c:\\users\\luis\\source\\repos\\AACharly\\node_modules\\xml2js"
"sax@0.5.2",
"C:\\Users\\Luis\\source\\repos\\Bots\\AAMasters\\AACharly-Extraction-Bot"
]
],
"_from": "sax@>=0.5.0-0 <0.6.0-0",
"_id": "sax@0.5.8",
"_inCache": true,
"_from": "sax@0.5.2",
"_id": "sax@0.5.2",
"_inBundle": false,
"_integrity": "sha1-c1/6o5oc/4/7lZjwIjq9sDqfsuo=",
"_location": "/sax",
"_npmUser": {
"email": "i@izs.me",
"name": "isaacs"
},
"_npmVersion": "1.3.15",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "sax@0.5.2",
"name": "sax",
"raw": "sax@0.5.x",
"rawSpec": "0.5.x",
"scope": null,
"spec": ">=0.5.0-0 <0.6.0-0",
"type": "range"
"escapedName": "sax",
"rawSpec": "0.5.2",
"saveSpec": null,
"fetchSpec": "0.5.2"
},
"_requiredBy": [
"/xml2js"
"/azure-storage/xml2js"
],
"_resolved": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz",
"_shasum": "d472db228eb331c2506b0e8c15524adb939d12c1",
"_shrinkwrap": null,
"_spec": "sax@0.5.x",
"_where": "c:\\users\\luis\\source\\repos\\AACharly\\node_modules\\xml2js",
"_resolved": "https://registry.npmjs.org/sax/-/sax-0.5.2.tgz",
"_spec": "0.5.2",
"_where": "C:\\Users\\Luis\\source\\repos\\Bots\\AAMasters\\AACharly-Extraction-Bot",
"author": {
"email": "i@izs.me",
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
@@ -77,26 +73,11 @@
"email": "mike@emotive.com"
}
],
"dependencies": {},
"description": "An evented streaming XML parser in JavaScript",
"devDependencies": {},
"directories": {},
"dist": {
"shasum": "d472db228eb331c2506b0e8c15524adb939d12c1",
"tarball": "https://registry.npmjs.org/sax/-/sax-0.5.8.tgz"
},
"homepage": "https://github.com/isaacs/sax-js",
"installable": true,
"homepage": "https://github.com/isaacs/sax-js#readme",
"license": "BSD",
"main": "lib/sax.js",
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
}
],
"name": "sax",
"optionalDependencies": {},
"repository": {
"type": "git",
"url": "git://github.com/isaacs/sax-js.git"
@@ -104,5 +85,5 @@
"scripts": {
"test": "node test/index.js"
},
"version": "0.5.8"
"version": "0.5.2"
}
-33
View File
@@ -1,33 +0,0 @@
require(__dirname).test(
{ xml: "<root length='12345'></root>"
, expect: [
["attribute", {
name: "length"
, value: "12345"
, prefix: ""
, local: "length"
, uri: ""
}]
, ["opentag", {
name: "root"
, prefix: ""
, local: "root"
, uri: ""
, attributes: {
length: {
name: "length"
, value: "12345"
, prefix: ""
, local: "length"
, uri: ""
}
}
, ns: {}
, isSelfClosing: false
}]
, ["closetag", "root"]
]
, strict: true
, opt: { xmlns: true }
}
)
-75
View File
@@ -1,75 +0,0 @@
// non-strict: no error
require(__dirname).test
( { xml : '<root attr1="first"attr2="second"/>'
, expect :
[ [ "attribute", { name: 'attr1', value: 'first' } ]
, [ "attribute", { name: 'attr2', value: 'second' } ]
, [ "opentag", { name: "root", attributes: {attr1: 'first', attr2: 'second'}, isSelfClosing: true } ]
, [ "closetag", "root" ]
]
, strict : false
, opt : { lowercase: true }
}
)
// strict: should give an error, but still parse
require(__dirname).test
( { xml : '<root attr1="first"attr2="second"/>'
, expect :
[ [ "attribute", { name: 'attr1', value: 'first' } ]
, [ "error", "No whitespace between attributes\nLine: 0\nColumn: 20\nChar: a" ]
, [ "attribute", { name: 'attr2', value: 'second' } ]
, [ "opentag", { name: "root", attributes: {attr1: 'first', attr2: 'second'}, isSelfClosing: true } ]
, [ "closetag", "root" ]
]
, strict : true
, opt : { }
}
)
// strict: other cases should still pass
require(__dirname).test
( { xml : '<root attr1="first" attr2="second"/>'
, expect :
[ [ "attribute", { name: 'attr1', value: 'first' } ]
, [ "attribute", { name: 'attr2', value: 'second' } ]
, [ "opentag", { name: "root", attributes: {attr1: 'first', attr2: 'second'}, isSelfClosing: true } ]
, [ "closetag", "root" ]
]
, strict : true
, opt : { }
}
)
// strict: other cases should still pass
require(__dirname).test
( { xml : '<root attr1="first"\nattr2="second"/>'
, expect :
[ [ "attribute", { name: 'attr1', value: 'first' } ]
, [ "attribute", { name: 'attr2', value: 'second' } ]
, [ "opentag", { name: "root", attributes: {attr1: 'first', attr2: 'second'}, isSelfClosing: true } ]
, [ "closetag", "root" ]
]
, strict : true
, opt : { }
}
)
// strict: other cases should still pass
require(__dirname).test
( { xml : '<root attr1="first" attr2="second"/>'
, expect :
[ [ "attribute", { name: 'attr1', value: 'first' } ]
, [ "attribute", { name: 'attr2', value: 'second' } ]
, [ "opentag", { name: "root", attributes: {attr1: 'first', attr2: 'second'}, isSelfClosing: true } ]
, [ "closetag", "root" ]
]
, strict : true
, opt : { }
}
)
-5
View File
@@ -1,5 +0,0 @@
var assert = require('assert');
var saxStream = require('../lib/sax').createStream();
assert.doesNotThrow(function() {
saxStream.end();
});
-13
View File
@@ -1,13 +0,0 @@
var parser = require(__dirname).test({
expect: [
['opentag', {'name':'T', attributes:{}, isSelfClosing: false}],
['text', 'flush'],
['text', 'rest'],
['closetag', 'T'],
]
});
parser.write('<T>flush');
parser.flush();
parser.write('rest</T>');
parser.close();
-32
View File
@@ -1,32 +0,0 @@
var assert = require('assert')
var saxStream = require('../lib/sax').createStream()
var b = new Buffer('误')
saxStream.on('text', function(text) {
assert.equal(text, b.toString())
})
saxStream.write(new Buffer('<test><a>'))
saxStream.write(b.slice(0, 1))
saxStream.write(b.slice(1))
saxStream.write(new Buffer('</a><b>'))
saxStream.write(b.slice(0, 2))
saxStream.write(b.slice(2))
saxStream.write(new Buffer('</b><c>'))
saxStream.write(b)
saxStream.write(new Buffer('</c>'))
saxStream.write(Buffer.concat([new Buffer('<d>'), b.slice(0, 1)]))
saxStream.end(Buffer.concat([b.slice(1), new Buffer('</d></test>')]))
var saxStream2 = require('../lib/sax').createStream()
saxStream2.on('text', function(text) {
assert.equal(text, '�')
});
saxStream2.write(new Buffer('<e>'));
saxStream2.write(new Buffer([0xC0]));
saxStream2.write(new Buffer('</e>'));
saxStream2.write(Buffer.concat([new Buffer('<f>'), b.slice(0,1)]));
saxStream2.end();
-15
View File
@@ -1,15 +0,0 @@
require(__dirname).test
( { xml :
"<xmlns/>"
, expect :
[ [ "opentag", { name: "xmlns", uri: "", prefix: "", local: "xmlns",
attributes: {}, ns: {},
isSelfClosing: true}
],
["closetag", "xmlns"]
]
, strict : true
, opt : { xmlns: true }
}
);
-33
View File
@@ -1,33 +0,0 @@
require(__dirname).test(
{ strict : true
, opt : { xmlns: true }
, expect :
[ [ "error", "Unbound namespace prefix: \"unbound:root\"\nLine: 0\nColumn: 15\nChar: >"]
, [ "opentag", { name: "unbound:root", uri: "unbound", prefix: "unbound", local: "root"
, attributes: {}, ns: {}, isSelfClosing: true } ]
, [ "closetag", "unbound:root" ]
]
}
).write("<unbound:root/>");
require(__dirname).test(
{ strict : true
, opt : { xmlns: true }
, expect :
[ [ "opennamespace", { prefix: "unbound", uri: "someuri" } ]
, [ "attribute", { name: 'xmlns:unbound', value: 'someuri'
, prefix: 'xmlns', local: 'unbound'
, uri: 'http://www.w3.org/2000/xmlns/' } ]
, [ "opentag", { name: "unbound:root", uri: "someuri", prefix: "unbound", local: "root"
, attributes: { 'xmlns:unbound': {
name: 'xmlns:unbound'
, value: 'someuri'
, prefix: 'xmlns'
, local: 'unbound'
, uri: 'http://www.w3.org/2000/xmlns/' } }
, ns: { "unbound": "someuri" }, isSelfClosing: true } ]
, [ "closetag", "unbound:root" ]
, [ "closenamespace", { prefix: 'unbound', uri: 'someuri' }]
]
}
).write("<unbound:root xmlns:unbound=\"someuri\"/>");