Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libxmljs2

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libxmljs2 - npm Package Compare versions

Comparing version 0.20.0 to 0.20.1

.editorconfig

14

package.json

@@ -12,7 +12,7 @@ {

"host": "https://github.com",
"remote_path": "./libxmljs/libxmljs/releases/download/v{version}/",
"remote_path": "./marudor/libxmljs2/releases/download/v{version}/",
"package_name": "{node_abi}-{platform}-{arch}-{libc}.tar.gz"
},
"description": "libxml bindings for v8 javascript engine",
"version": "0.20.0",
"version": "0.20.1",
"scripts": {

@@ -24,6 +24,6 @@ "install": "node-pre-gyp install --fallback-to-build --loglevel http",

"type": "git",
"url": "http://github.com/marudor/libxmljs.git"
"url": "http://github.com/marudor/libxmljs2.git"
},
"bugs": {
"url": "http://github.com/marudor/libxmljs/issues"
"url": "http://github.com/marudor/libxmljs2/issues"
},

@@ -37,9 +37,11 @@ "main": "./index",

"bindings": "~1.3.0",
"nan": "~2.10.0",
"node-pre-gyp": "~0.11.0"
"nan": "~2.13.1",
"node-pre-gyp": "~0.12.0"
},
"devDependencies": {
"github-release-cli": "^1.0.1",
"nodeunit": "~0.11.2",
"prettier": "^1.16.4",
"semver": "~5.5.0"
}
}

@@ -1,17 +0,21 @@

# Libxmljs
[![Build Status](https://secure.travis-ci.org/marudor/libxmljs.svg?branch=master)](http://travis-ci.org/marudor/libxmljs)
# Libxmljs2
<!-- [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/cf862a98w7qsajpl/branch/master?svg=true)](https://ci.appveyor.com/project/rchipka/libxmljs/branch/master) -->
[![Build Status](https://secure.travis-ci.org/marudor/libxmljs2.svg?branch=master)](http://travis-ci.org/marudor/libxmljs2)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/ji1580agkhxm165t/branch/master?svg=true)](https://ci.appveyor.com/project/marudor/libxmljs2/branch/master)
![Gitlab build Status](https://gitlab.com/marudor/libxmljs2/badges/master/pipeline.svg)
LibXML bindings for [node.js](http://nodejs.org/)
```javascript
var libxmljs = require("libxmljs");
var xml = '<?xml version="1.0" encoding="UTF-8"?>' +
'<root>' +
'<child foo="bar">' +
'<grandchild baz="fizbuzz">grandchild content</grandchild>' +
'</child>' +
'<sibling>with content!</sibling>' +
'</root>';
var libxmljs = require('libxmljs');
var xml =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<root>' +
'<child foo="bar">' +
'<grandchild baz="fizbuzz">grandchild content</grandchild>' +
'</child>' +
'<sibling>with content!</sibling>' +
'</root>';

@@ -23,3 +27,3 @@ var xmlDoc = libxmljs.parseXml(xml);

console.log(gchild.text()); // prints "grandchild content"
console.log(gchild.text()); // prints "grandchild content"

@@ -34,10 +38,10 @@ var children = xmlDoc.root().childNodes();

* Docs - [http://github.com/marudor/libxmljs/wiki](http://github.com/marudor/libxmljs/wiki)
<!-- * Mailing list - [http://groups.google.com/group/libxmljs](http://groups.google.com/group/libxmljs) -->
- Docs - [http://github.com/marudor/libxmljs2/wiki](http://github.com/marudor/libxmljs2/wiki)
<!-- * Mailing list - [http://groups.google.com/group/libxmljs](http://groups.google.com/group/libxmljs) -->
## API and Examples
Check out the wiki [http://github.com/marudor/libxmljs/wiki](http://github.com/libxmljs/libxmljs/wiki).
Check out the wiki [http://github.com/marudor/libxmljs2/wiki](http://github.com/libxmljs/libxmljs2/wiki).
See the [examples](https://github.com/marudor/libxmljs/tree/master/examples) folder.
See the [examples](https://github.com/marudor/libxmljs2/tree/master/examples) folder.

@@ -52,3 +56,3 @@ ## Installation via [npm](https://npmjs.org)

Start by checking out the [open issues](https://github.com/marudor/libxmljs/issues?labels=&page=1&state=open). Specifically the [desired feature](https://github.com/marudor/libxmljs/issues?labels=desired+feature&page=1&state=open) ones.
Start by checking out the [open issues](https://github.com/marudor/libxmljs2/issues?labels=&page=1&state=open). Specifically the [desired feature](https://github.com/marudor/libxmljs2/issues?labels=desired+feature&page=1&state=open) ones.

@@ -55,0 +59,0 @@ ### Requirements

@@ -5,106 +5,116 @@ var libxml = require('../index');

if (!global.gc) {
throw new Error('must run with --expose_gc for memory management tests');
throw new Error('must run with --expose_gc for memory management tests');
}
var nodeVersion = process.versions.node
var shouldSkip = semver.satisfies(nodeVersion, '8.x || 9.x || 10.x')
var nodeVersion = process.versions.node;
var shouldSkip = semver.satisfies(nodeVersion, '8.x || 9.x || 10.x');
module.exports.setUp = function(done) {
collectGarbage();
done();
collectGarbage();
done();
};
module.exports.inaccessible_document_freed = function(assert) {
var xml_memory_before_document = libxml.memoryUsage();
for (var i=0; i<10; i++) {
makeDocument();
}
var xml_memory_before_document = libxml.memoryUsage();
for (var i = 0; i < 10; i++) {
makeDocument();
}
process.nextTick(() => {
collectGarbage();
assert.ok(libxml.memoryUsage() <= xml_memory_before_document);
assert.done();
});
};
module.exports.inaccessible_document_freed_when_node_freed = function(assert) {
if (shouldSkip) {
assert.done();
console.warn('skipping inaccessible_document_freed_when_node_freed');
return;
}
if (shouldSkip) {
assert.done();
console.warn('skipping inaccessible_document_freed_when_node_freed');
return;
}
var xml_memory_before_document = libxml.memoryUsage();
var nodes = [];
for (var i=0; i<10; i++) {
nodes.push(makeDocument().get('//center'));
}
nodes = null;
var xml_memory_before_document = libxml.memoryUsage();
var nodes = [];
for (var i = 0; i < 10; i++) {
nodes.push(makeDocument().get('//center'));
}
nodes = null;
process.nextTick(() => {
collectGarbage();
assert.ok(libxml.memoryUsage() <= xml_memory_before_document);
assert.done();
});
};
module.exports.inaccessible_document_freed_after_middle_nodes_proxied = function(assert) {
var xml_memory_before_document = libxml.memoryUsage();
var doc = makeDocument();
var middle = doc.get('//middle');
var inner = doc.get('//inner');
inner.remove(); // v0.14.3, v0.15: proxy ref'd parent but can't unref when destroyed
doc = middle = inner = null;
var xml_memory_before_document = libxml.memoryUsage();
var doc = makeDocument();
var middle = doc.get('//middle');
var inner = doc.get('//inner');
inner.remove(); // v0.14.3, v0.15: proxy ref'd parent but can't unref when destroyed
doc = middle = inner = null;
process.nextTick(() => {
collectGarbage();
assert.ok(libxml.memoryUsage() <= xml_memory_before_document);
assert.done();
});
};
module.exports.inaccessible_tree_freed = function(assert) {
if (shouldSkip) {
assert.done();
console.warn('skipping inaccessible_tree_freed');
return;
}
if (shouldSkip) {
assert.done();
console.warn('skipping inaccessible_tree_freed');
return;
}
var doc = makeDocument();
var xml_memory_after_document = libxml.memoryUsage();
doc.get('//middle').remove();;
var doc = makeDocument();
var xml_memory_after_document = libxml.memoryUsage();
doc.get('//middle').remove();
process.nextTick(() => {
collectGarbage();
assert.ok(libxml.memoryUsage() < xml_memory_after_document);
assert.ok(libxml.memoryUsage() <= xml_memory_after_document);
assert.done();
});
};
module.exports.namespace_list_freed = function(assert) {
var doc = makeDocument();
var el = doc.get('//center');
el.namespace("bar", null);
var xmlMemBefore = libxml.memoryUsage();
for (var i; i<1000; i++) {
el.namespaces()
}
var doc = makeDocument();
var el = doc.get('//center');
el.namespace('bar', null);
var xmlMemBefore = libxml.memoryUsage();
for (var i; i < 1000; i++) {
el.namespaces();
}
process.nextTick(() => {
collectGarbage();
assert.ok(libxml.memoryUsage() <= xmlMemBefore);
assert.done();
});
};
function makeDocument() {
var body = "<?xml version='1.0' encoding='UTF-8'?>\n" +
"<root><outer><middle><inner><center/></inner></middle></outer></root>";
return libxml.parseXml(body);
var body =
"<?xml version='1.0' encoding='UTF-8'?>\n" +
'<root><outer><middle><inner><center/></inner></middle></outer></root>';
return libxml.parseXml(body);
}
function collectGarbage(minCycles, maxCycles) {
minCycles = minCycles || 3;
maxCycles = maxCycles || 10;
minCycles = minCycles || 3;
maxCycles = maxCycles || 10;
var cycles = 0;
var freedRss = 0;
var usage = process.memoryUsage();
do {
global.gc();
var cycles = 0;
var freedRss = 0;
var usage = process.memoryUsage();
do {
global.gc();
var usageAfterGc = process.memoryUsage();
freedRss = usage.rss - usageAfterGc.rss;
usage = usageAfterGc;
var usageAfterGc = process.memoryUsage();
freedRss = usage.rss - usageAfterGc.rss;
usage = usageAfterGc;
cycles++;
}
while ((cycles < minCycles) || ((freedRss !== 0) && (cycles < maxCycles)));
cycles++;
} while (cycles < minCycles || (freedRss !== 0 && cycles < maxCycles));
return usage;
return usage;
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc