From 004d20c3437c5a998376e73f0c44a0f9201e308f Mon Sep 17 00:00:00 2001 From: Eric Newport Date: Wed, 4 Mar 2020 11:27:46 -0500 Subject: [PATCH] Various maintenance (#28) * Various maintenance - More package.json refactoring. - Removed .npmignore in favor of `files` entry in package.json. - Renamed dom-parser.js to domParser.js. - Replaced CHANGELOG with more rigorous file. - Replaced LICENSE with more rigorous file. - Removed component.json (deprecated package manager https://github.com/componentjs/guide) - `proof` devDep updated to latest. Closes #2. Closes #12. Closes #20. Requesting review from @brodybits @timbru31. Pending approval and merge, we should release this as 0.2.2. * CHANGELOG tweak * Bump minor instead of patch * Bump minor instead of patch * fix tests? * fix tests * rename... * fix tests * fix package lock * update CHANGELOG and tilda proof. * rename back * update CHANGELOG * consistency * moving files to lib * Update lib/dom-parser.js Co-Authored-By: Chris Brody * Update CHANGELOG.md Co-Authored-By: Chris Brody * past tense Co-authored-by: Chris Brody --- .npmignore | 5 - CHANGELOG.md | 92 +++++++++++++ LICENSE | 8 -- LICENSE.md | 4 + __package__.js | 2 +- changelog | 14 -- component.json | 10 -- dom-parser.js => lib/dom-parser.js | 15 +- dom.js => lib/dom.js | 0 entities.js => lib/entities.js | 0 sax.js => lib/sax.js | 0 package-lock.json | 211 +++++++++++++++++++++++++++++ package.json | 11 +- t/dom/require.t.js | 2 +- test/parse/test-define.js | 4 +- 15 files changed, 325 insertions(+), 53 deletions(-) delete mode 100644 .npmignore create mode 100644 CHANGELOG.md delete mode 100644 LICENSE create mode 100644 LICENSE.md delete mode 100644 changelog delete mode 100644 component.json rename dom-parser.js => lib/dom-parser.js (99%) rename dom.js => lib/dom.js (100%) rename entities.js => lib/entities.js (100%) rename sax.js => lib/sax.js (100%) create mode 100644 package-lock.json diff --git a/.npmignore b/.npmignore deleted file mode 100644 index b094a4424..000000000 --- a/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -test -t -travis.yml -.project -changelog diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..9bb29ec44 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,92 @@ +## 0.3.0 + +- Node >=10.x now required. +- Added getElementsByClassName method. +- Added Node to the list of exports +- Added lowercase of åäö in entityMap. +- Moved existing sources into `lib` subdirectory. +- Removed `.npmignore` in favor of `files` entry in package.json. +- More `package.json` refactoring. +- Replaced CHANGELOG with more rigorous file. +- Replaced LICENSE with more rigorous file. +- Removed component.json (deprecated package manager https://github.com/componentjs/guide) +- `proof` devDep updated to latest. +- Fixed CI. +- README updates. + +## 0.2.1 + +- More package.json refactoring. + +## 0.2.0 + +- Now publishing under xmldom npm package again; retiring xmldom-alpha. +- Remove coveralls. +- Disable cache in travis. +- Other refactoring. + +## 0.1.28 (via xmldom-alpha npm package) + +- Removed __proto__ accessor. +- Appended HTML entities defaults. + +## 0.1.27 (via xmldom-alpha npm package) + +- Various bug fixes. +- Don't ask why 0.1.26 and 0.1.25 were skipped. `¯\_(ツ)_/¯` + +## 0.1.24 (via xmldom-alpha package) + +- Added node filter. + +## 0.1.23 (via xmldom-alpha npm package) + +- Added namespace support for nest node serialize. +- Various other bug fixes. + +## 0.1.22 + +- Merge XMLNS serialization. +- Removed \r from source string. +- Print namespaces for child elements. +- Switch references to nodeType to use named constants. +- Add nodelist toString support. + +## 0.1.21 + +- Fixed serialize bug. + +## 0.1.20 + +- Optimized invalid XML support. +- Added toString sorter for attributes output. +- Added html self closed node button. +- Added `*` NS support for getElementsByTagNameNS. +- Converted attribute's value to string in setAttributeNS. +- Added support for HTML entities for HTML docs only. +- Fixed TypeError when Document is created with DocumentType. + +## 0.1.19 + +- Fixed issue #68, infinite loop on unclosed comment. +- Added error report for unclosed tag. +- Various other fixes. + +## 0.1.18 + +- Added default `ns` support. +- parseFromString now renders entirely plain text documents as textNode. +- Enabled option to ignore white space on parsing. + +## 0.1.16 + +- Correctly handle multibyte Unicode greater than two byts. #57. #56. +- Initial unit testing and test coverage. #53. #46. #19. +- Create Bower `component.json` #52. + +## 0.1.8 + +- Add: some test case from node-o3-xml(excludes xpath support) +- Fix: remove existed attribute before setting (bug introduced in v0.1.5) +- Fix: index direct access for childNodes and any NodeList collection(not w3c standard) +- Fix: remove last child bug diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 68a9b5e1b..000000000 --- a/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -You can choose any one of those: - -The MIT License (MIT): - -link:http://opensource.org/licenses/MIT - -LGPL: -http://www.gnu.org/licenses/lgpl.html diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..dc140c79b --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,4 @@ +You can choose any one of these licenses: + +- MIT: https://opensource.org/licenses/MIT +- LGPL: http://www.gnu.org/licenses/lgpl.html diff --git a/__package__.js b/__package__.js index 93af3495a..31916d972 100644 --- a/__package__.js +++ b/__package__.js @@ -1,4 +1,4 @@ this.addScript('dom.js',['DOMImplementation','XMLSerializer']); this.addScript('dom-parser.js',['DOMHandler','DOMParser'], ['DOMImplementation','XMLReader']); -this.addScript('sax.js','XMLReader'); \ No newline at end of file +this.addScript('sax.js','XMLReader'); diff --git a/changelog b/changelog deleted file mode 100644 index ab815bb8f..000000000 --- a/changelog +++ /dev/null @@ -1,14 +0,0 @@ -### Version 0.1.16 - -Sat May 4 14:58:03 UTC 2013 - - * Correctly handle multibyte Unicode greater than two byts. #57. #56. - * Initial unit testing and test coverage. #53. #46. #19. - * Create Bower `component.json` #52. - -### Version 0.1.8 - - * Add: some test case from node-o3-xml(excludes xpath support) - * Fix: remove existed attribute before setting (bug introduced in v0.1.5) - * Fix: index direct access for childNodes and any NodeList collection(not w3c standard) - * Fix: remove last child bug diff --git a/component.json b/component.json deleted file mode 100644 index 93b4d5707..000000000 --- a/component.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "xmldom", - "version": "0.1.15", - "main": "dom-parser.js", - "ignore": [ - "**/.*", - "node_modules", - "components" - ] -} diff --git a/dom-parser.js b/lib/dom-parser.js similarity index 99% rename from dom-parser.js rename to lib/dom-parser.js index e45dd476f..92937fdcc 100644 --- a/dom-parser.js +++ b/lib/dom-parser.js @@ -1,6 +1,5 @@ function DOMParser(options){ this.options = options ||{locator:{}}; - } DOMParser.prototype.parseFromString = function(source,mimeType){ @@ -15,7 +14,7 @@ DOMParser.prototype.parseFromString = function(source,mimeType){ if(locator){ domBuilder.setDocumentLocator(locator) } - + sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); sax.domBuilder = options.domBuilder || domBuilder; if(isHTML){ @@ -58,8 +57,8 @@ function buildErrorHandler(errorImpl,domBuilder,locator){ /** * +ContentHandler+ErrorHandler * +LexicalHandler+EntityResolver2 - * -DeclHandler-DTDHandler - * + * -DeclHandler-DTDHandler + * * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html @@ -74,7 +73,7 @@ function position(locator,node){ /** * @see org.xml.sax.ContentHandler#startDocument * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html - */ + */ DOMHandler.prototype = { startDocument : function() { this.doc = new DOMImplementation().createDocument(null, null, null); @@ -88,7 +87,7 @@ DOMHandler.prototype = { var len = attrs.length; appendElement(this, el); this.currentElement = el; - + this.locator && position(this.locator,el) for (var i = 0 ; i < len; i++) { var namespaceURI = attrs.getURI(i); @@ -151,7 +150,7 @@ DOMHandler.prototype = { this.locator && position(this.locator,comm) appendElement(this, comm); }, - + startCDATA:function() { //used in characters() methods this.cdata = true; @@ -159,7 +158,7 @@ DOMHandler.prototype = { endCDATA:function() { this.cdata = false; }, - + startDTD:function(name, publicId, systemId) { var impl = this.doc.implementation; if (impl && impl.createDocumentType) { diff --git a/dom.js b/lib/dom.js similarity index 100% rename from dom.js rename to lib/dom.js diff --git a/entities.js b/lib/entities.js similarity index 100% rename from entities.js rename to lib/entities.js diff --git a/sax.js b/lib/sax.js similarity index 100% rename from sax.js rename to lib/sax.js diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..aae91fecc --- /dev/null +++ b/package-lock.json @@ -0,0 +1,211 @@ +{ + "name": "xmldom", + "version": "0.3.0-dev", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "abend": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/abend/-/abend-1.0.11.tgz", + "integrity": "sha512-WdxoXvQPrKPz1TV3g20CFFyfZ+mux3xV42++JanQJFW9Zymxft5S9uSmXBpdvghblXD1ul1udzuEWqPxy9rAyQ==", + "dev": true + }, + "arguable": { + "version": "8.0.9", + "resolved": "https://registry.npmjs.org/arguable/-/arguable-8.0.9.tgz", + "integrity": "sha512-UPMHbZsrpBxMwbntTATDMd5JIcP5kfm1tLER+RY8k0SpkHzFp2sSE8RPgVB3OXYpT5X1Iw4RXiR0CGeYCE/zkQ==", + "dev": true, + "requires": { + "cadence": "3.0.x", + "destructible": "2.0.x", + "interrupt": "7.0.x", + "rescue": "5.0.x", + "signal": "7.0.x", + "synonymous": "1.0.x" + } + }, + "byline": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/byline/-/byline-5.0.0.tgz", + "integrity": "sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE=", + "dev": true + }, + "cadence": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/cadence/-/cadence-3.0.6.tgz", + "integrity": "sha512-WKvm8hvePZzh1cKP/UtlO6gtt0JtMs2XHKmtHMSz7peoBL5xk3TQ55zn9F4hLMBph/4W27outs79a5Q07ckH3g==", + "dev": true + }, + "deep-diff": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-1.0.2.tgz", + "integrity": "sha512-aWS3UIVH+NPGCD1kki+DCU9Dua032iSsO43LqQpcs4R3+dVv7tX0qBGjiVHJHjplsoUM2XRO/KB92glqc68awg==", + "dev": true + }, + "deep-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", + "dev": true + }, + "delay": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-4.2.0.tgz", + "integrity": "sha512-EBX+pZE4qSowGAMr6M0cLiPRQu2Kus/qTNLO7c+EoXpTPJH9ApFdHX+cQU1WsSHXgwhLyidfZ5Hxuq6ctWhSdw==", + "dev": true + }, + "delta": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/delta/-/delta-3.0.5.tgz", + "integrity": "sha512-mQsNj3oBJ/4W0RCfppOMNEh/WFup4aVAFAtDWWjjgbDDJXdizG6rLnsmA6YTtvIqHQN1c478fQBGbkaWiQQKQw==", + "dev": true + }, + "departure": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/departure/-/departure-1.0.3.tgz", + "integrity": "sha512-zz5ONp1FYBbOCfbA08zT8HtE92euiBR1nW0SPKslJSQmmYCGdQqdEBaq0OmGYsSnGdBBB6DCVZcb/HWDjBW3RQ==", + "dev": true, + "requires": { + "deep-diff": "1.0.x", + "deep-equal": "1.0.1" + } + }, + "destructible": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/destructible/-/destructible-2.0.2.tgz", + "integrity": "sha512-n91xrFgZP8UcfcL6o2bIdZIwr1Wms1/ghLPNCaSliQ9np3l6n7JSLQzBFjGfB2nsYkMIbXanhw4XcYB9cM94GQ==", + "dev": true, + "requires": { + "cadence": "3.0.x", + "delay": "4.2.0", + "interrupt": "7.0.x", + "operation": "5.0.x", + "signal": "7.0.x" + } + }, + "expandable": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/expandable/-/expandable-1.0.2.tgz", + "integrity": "sha512-/OyY/bVG3SfzA2UUyLQqGDNwjO52tCJMmH2EQjBd2Ygd5tPbetH2v6Luo8PhZuH8kJf3JvUYZNuwMBBGo1J/MA==", + "dev": true + }, + "extant": { + "version": "1.0.17", + "resolved": "https://registry.npmjs.org/extant/-/extant-1.0.17.tgz", + "integrity": "sha512-qOAmBd+D8ksq7osIASN+cAWVKVTAvjeUJqYQum3gYqN6jWnxuuFmmqLXo/2rxZop4UjWBuGTK0kGOpeb+r2YPQ==", + "dev": true + }, + "interrupt": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/interrupt/-/interrupt-7.0.5.tgz", + "integrity": "sha512-ghADtYAhiJvgm+jNEWruX/ymnlxPoY4bAd45NDkCr4IHv/NtBVvctDV4N2IyvBzTbF/BFxZs/bAhBkUHsrTwHA==", + "dev": true, + "requires": { + "extant": "1.0.x", + "stacktrace-parser": "0.1.5" + } + }, + "nop": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/nop/-/nop-1.0.0.tgz", + "integrity": "sha1-y0bPfgFXSqY5CFgUn2aJev5Tyco=", + "dev": true + }, + "operation": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/operation/-/operation-5.0.2.tgz", + "integrity": "sha512-tFuFcNZMND6vA40IX+faGKE4xrsM9IIqgHf4peTqB1aMLIB0RwjFMzMq5DP0SgWuUEcKGWJFqOCh7xlH2lP50A==", + "dev": true + }, + "proof": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/proof/-/proof-7.0.9.tgz", + "integrity": "sha512-E0vPM3bnHLtpKqYE+vReQqWTU3Q82irayZvuTjI4yz9suMBDjvSMmQEBrBYXT3y7DTjR8tDS2o+KJxs9t2DhsA==", + "dev": true, + "requires": { + "arguable": "8.0.x", + "byline": "5.0.0", + "cadence": "3.0.x", + "deep-equal": "1.0.1", + "delta": "3.0.x", + "departure": "1.0.x", + "expandable": "1.0.x", + "extant": "1.0.x", + "rescue": "5.0.x", + "staccato": "8.0.x", + "turnstile": "5.0.x" + } + }, + "rescue": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/rescue/-/rescue-5.0.4.tgz", + "integrity": "sha512-dIJ5WfY+0a45YTdNr78jvDylC9qVSwDcmH6sv7FQYLQ40Pa7NEy/9mygBucwJIzXPCZvccMoOWGfMba1nPow4A==", + "dev": true + }, + "signal": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/signal/-/signal-7.0.6.tgz", + "integrity": "sha512-9SnDOIATtoRktT5ePD68F+B5i3ZugSBHB1HrBhaI/kkhaMBaMMatoDn+ajdgnFE5Xz1hWliLkpwVEnj3+S+ntg==", + "dev": true, + "requires": { + "operation": "5.0.x" + } + }, + "sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "dev": true + }, + "staccato": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/staccato/-/staccato-8.0.2.tgz", + "integrity": "sha512-Pfu2WmBjQy6+WCcLSPgh7F/51G3LCj5vOQK/nLHU2GSaILBX5xP5lTzKkQ7MzI86uPfl0MCfHUyeGePGPwrfFQ==", + "dev": true, + "requires": { + "cadence": "3.0.x", + "delta": "3.0.x", + "extant": "1.0.x", + "interrupt": "7.0.x" + } + }, + "stacktrace-parser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.5.tgz", + "integrity": "sha512-fjJ563lEMEXdqUH8fZR84sczWxM+Pi3bViix1n7371mFr8sL7UPewec79+IhHkN4UMmGbXoXj58WIaF7lIciRA==", + "dev": true, + "requires": { + "type-fest": "^0.3.0" + } + }, + "synonymous": { + "version": "1.0.21", + "resolved": "https://registry.npmjs.org/synonymous/-/synonymous-1.0.21.tgz", + "integrity": "sha512-JK+Jo/fIbFCm2jLCu876mHFssW4eWVONZakXsotq/5REvuRSUmcD02558aI+FpiPIoD/y4jdelmlnTEJfvv23A==", + "dev": true, + "requires": { + "sprintf-js": "1.1.2" + } + }, + "turnstile": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/turnstile/-/turnstile-5.0.5.tgz", + "integrity": "sha512-z8zPZjdTDnwg/gBRJDbHQEXRX7+kEMkvLIyIyvt1w+sz0EoKRwNlJXeR+pBzx/u+wz7hcMlFTFaxBhq4zFWBXg==", + "dev": true, + "requires": { + "abend": "1.0.x", + "cadence": "3.0.x", + "extant": "1.0.x", + "interrupt": "7.0.x", + "nop": "1.0.x", + "operation": "5.0.x" + } + }, + "type-fest": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "dev": true + } + } +} diff --git a/package.json b/package.json index e40084be6..97b33d9ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xmldom", - "version": "0.2.2-dev", + "version": "0.3.0-dev", "description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.", "keywords": [ "w3c", @@ -17,16 +17,19 @@ "type": "git", "url": "git://github.com/xmldom/xmldom.git" }, - "main": "./dom-parser.js", + "main": "lib/dom-parser.js", + "files": [ + "lib" + ], "scripts": { "test": "proof platform win32 && proof test */*/*.t.js || t/test" }, "engines": { - "node": ">=0.1" + "node": ">=10.0.0" }, "dependencies": {}, "devDependencies": { - "proof": "0.0.28" + "proof": "~7.0.9" }, "maintainers": [ { diff --git a/t/dom/require.t.js b/t/dom/require.t.js index 2464e935c..e8f50fe83 100755 --- a/t/dom/require.t.js +++ b/t/dom/require.t.js @@ -1,5 +1,5 @@ #!/usr/bin/env node require('proof')(1, function (ok) { - ok(require('../..'), 'require'); + ok(require('../../lib/dom-parser'), 'require'); }); diff --git a/test/parse/test-define.js b/test/parse/test-define.js index 1120950f5..ed949f096 100644 --- a/test/parse/test-define.js +++ b/test/parse/test-define.js @@ -1,3 +1,3 @@ console.log(__dirname) -exports.XMLSerializer = require('../../dom').XMLSerializer ; -exports.DOMParser = require('../../dom-parser').DOMParser; \ No newline at end of file +exports.XMLSerializer = require('../../lib/dom').XMLSerializer ; +exports.DOMParser = require('../../lib/dom-parser').DOMParser;