diff --git a/.tidyversion b/.tidyversion index 4cc0e35..edb1d39 100644 --- a/.tidyversion +++ b/.tidyversion @@ -1 +1 @@ -5.6.0 \ No newline at end of file +5.8.0 \ No newline at end of file diff --git a/bin/darwin/tidy b/bin/darwin/tidy index d52b6a5..495acec 100755 Binary files a/bin/darwin/tidy and b/bin/darwin/tidy differ diff --git a/bin/linux32/tidy b/bin/linux32/tidy deleted file mode 100755 index 6541c9a..0000000 Binary files a/bin/linux32/tidy and /dev/null differ diff --git a/bin/linux64/tidy b/bin/linux64/tidy index 6541c9a..b8b937e 100755 Binary files a/bin/linux64/tidy and b/bin/linux64/tidy differ diff --git a/bin/win32/tidy.exe b/bin/win32/tidy.exe deleted file mode 100644 index ffc0eb1..0000000 Binary files a/bin/win32/tidy.exe and /dev/null differ diff --git a/bin/win64/tidy.exe b/bin/win64/tidy.exe index 2384d04..45405aa 100644 Binary files a/bin/win64/tidy.exe and b/bin/win64/tidy.exe differ diff --git a/htmltidy.js b/htmltidy.js index 1600632..43cecb2 100644 --- a/htmltidy.js +++ b/htmltidy.js @@ -26,8 +26,8 @@ function TidyWorker(opts) { // Store a reference to the merged options for consumption by error reporting logic var mergedOpts = merge(opts, DEFAULT_OPTS); - this.writable= true; - this.readable= true; + this.writable = true; + this.readable = true; this._worker = spawn(tidyExec, parseOpts(mergedOpts)); this._worker.stdout.setEncoding('utf8'); var self = this; @@ -36,8 +36,8 @@ function TidyWorker(opts) { self.emit('drain'); }); this._worker.stdin.on('error', function (errors) { - self.emit('error', errors); - }); + self.emit('error', errors); + }); this._worker.stdout.on('data', function (data) { self.emit('data', data); }); @@ -45,20 +45,20 @@ function TidyWorker(opts) { self.emit('close'); }); this._worker.stderr.on('data', function (data) { - errors+= data; + errors += data; }); this._worker.on('close', function (code) { - switch(code){ + switch (code) { // If there were any warnings or errors from Tiny command case TIDY_WARN: // The user asks to see warnings. - if(mergedOpts.showWarnings){ + if (mergedOpts.showWarnings) { self.emit('error', errors); } break; case TIDY_ERR: // The user asks to see errors. - if(mergedOpts.showErrors){ + if (mergedOpts.showErrors) { self.emit('error', errors); } break; @@ -83,14 +83,14 @@ TidyWorker.prototype.end = function (data) { this._worker.stdin.end(data); }; -TidyWorker.prototype.pause = function () { +TidyWorker.prototype.pause = function () { if (!this._worker) throw new Error('worker has been destroyed'); if (this._worker.stdout.pause) this._worker.stdout.pause(); }; -TidyWorker.prototype.resume = function () { +TidyWorker.prototype.resume = function () { if (!this._worker) throw new Error('worker has been destroyed'); if (this._worker.stdout.resume) @@ -101,7 +101,7 @@ TidyWorker.prototype.destroy = function () { if (this._worker) return; this._worker.kill(); - this._worker= null; + this._worker = null; this.emit('close'); }; @@ -125,10 +125,10 @@ function tidy(text, opts, cb) { result += data; }); worker.on('error', function (data) { - error+= data; + error += data; }); worker.on('close', function (code) { - setImmediate(function(){cb(error, result);}); + setImmediate(function () { cb(error, result); }); }); worker.end(text); } @@ -137,17 +137,17 @@ function chooseExec() { var tidyExe; switch (process.platform) { case 'win32': - if(process.arch == 'x64'){ - tidyExe = path.join('win64/','tidy.exe'); + if (process.arch == 'x64') { + tidyExe = path.join('win64/', 'tidy.exe'); } else { - tidyExe = path.join('win32/','tidy.exe'); + throw new Error('unsupported execution platform'); } break; case 'linux': - if(process.arch == 'x64'){ - tidyExe = path.join('linux64/','tidy'); + if (process.arch == 'x64') { + tidyExe = path.join('linux64/', 'tidy'); } else { - tidyExe = path.join('linux32/','tidy'); + throw new Error('unsupported execution platform'); } break; case 'darwin': @@ -158,9 +158,9 @@ function chooseExec() { } tidyExe = path.join(__dirname, 'bin', tidyExe); - var existsSync = fs.existsSync||path.existsSync; // node > 0.6 + var existsSync = fs.existsSync || path.existsSync; // node > 0.6 if (!existsSync(tidyExe)) - throw new Error('missing tidy executable: ' + tidyExe); + throw new Error('missing tidy executable: ' + tidyExe); return tidyExe; } @@ -175,7 +175,7 @@ function parseOpts(opts) { args.push(opts[n]); break; case 'boolean': - args.push(opts[n]? 'yes': 'no'); + args.push(opts[n] ? 'yes' : 'no'); break; default: throw new Error('unknown option type'); @@ -185,7 +185,7 @@ function parseOpts(opts) { } function toHyphens(str) { - return str.replace(/([A-Z])/g, function (m, w) { return '-' + w.toLowerCase(); }); + return str.replace(/([A-Z])/g, function (m, w) { return '-' + w.toLowerCase(); }); } /** diff --git a/package.json b/package.json index 62502e9..107e69a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "htmltidy2", - "version": "0.3.0", + "version": "1.0.0", "description": "HTML Tidy", "main": "htmltidy.js", "scripts": { @@ -16,6 +16,9 @@ "url": "https://github.com/c0b41/htmltidy2/issues" }, "homepage": "https://github.com/c0b41/htmltidy2", + "engines": { + "node": ">= 12 || >= 14 || >= 16" + }, "devDependencies": { "expect.js": "^0.3.1", "mocha": "^3.2.0"