diff --git a/dist/w3c-html-validator.d.ts b/dist/w3c-html-validator.d.ts index 47bac15..c3c1046 100644 --- a/dist/w3c-html-validator.d.ts +++ b/dist/w3c-html-validator.d.ts @@ -1,4 +1,4 @@ -//! w3c-html-validator v1.1.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License +//! w3c-html-validator v1.1.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License export declare type ValidatorOptions = { html?: string; diff --git a/dist/w3c-html-validator.js b/dist/w3c-html-validator.js index 8a14b6d..e1cab21 100644 --- a/dist/w3c-html-validator.js +++ b/dist/w3c-html-validator.js @@ -1,12 +1,13 @@ -//! w3c-html-validator v1.1.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License +//! w3c-html-validator v1.1.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License import { readFileSync } from 'fs'; import chalk from 'chalk'; import log from 'fancy-log'; import request from 'superagent'; const w3cHtmlValidator = { - version: '1.1.0', + version: '1.1.1', validate(options) { + var _a; const defaults = { checkUrl: 'https://validator.w3.org/nu/', ignoreLevel: null, @@ -21,8 +22,8 @@ const w3cHtmlValidator = { if (settings.output !== 'json' && settings.output !== 'html') throw Error('[w3c-html-validator] Option "output" must be "json" or "html".'); const mode = settings.html ? 'html' : settings.filename ? 'filename' : 'website'; - const readFile = () => settings.filename ? readFileSync(settings.filename, 'utf8') : null; - const inputHtml = settings.html || readFile(); + const readFile = (filename) => readFileSync(filename, 'utf8').replace(/\r/g, ''); + const inputHtml = (_a = settings.html) !== null && _a !== void 0 ? _a : (settings.filename ? readFile(settings.filename) : null); const makePostRequest = () => request.post(settings.checkUrl) .set('Content-Type', 'text/html; encoding=utf-8') .send(inputHtml); diff --git a/dist/w3c-html-validator.umd.cjs b/dist/w3c-html-validator.umd.cjs index 0087591..a441d90 100644 --- a/dist/w3c-html-validator.umd.cjs +++ b/dist/w3c-html-validator.umd.cjs @@ -1,4 +1,4 @@ -//! w3c-html-validator v1.1.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License +//! w3c-html-validator v1.1.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; @@ -20,8 +20,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { const fancy_log_1 = __importDefault(require("fancy-log")); const superagent_1 = __importDefault(require("superagent")); const w3cHtmlValidator = { - version: '1.1.0', + version: '1.1.1', validate(options) { + var _a; const defaults = { checkUrl: 'https://validator.w3.org/nu/', ignoreLevel: null, @@ -36,8 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { if (settings.output !== 'json' && settings.output !== 'html') throw Error('[w3c-html-validator] Option "output" must be "json" or "html".'); const mode = settings.html ? 'html' : settings.filename ? 'filename' : 'website'; - const readFile = () => settings.filename ? (0, fs_1.readFileSync)(settings.filename, 'utf8') : null; - const inputHtml = settings.html || readFile(); + const readFile = (filename) => (0, fs_1.readFileSync)(filename, 'utf8').replace(/\r/g, ''); + const inputHtml = (_a = settings.html) !== null && _a !== void 0 ? _a : (settings.filename ? readFile(settings.filename) : null); const makePostRequest = () => superagent_1.default.post(settings.checkUrl) .set('Content-Type', 'text/html; encoding=utf-8') .send(inputHtml); diff --git a/package.json b/package.json index 881bf07..4e9316d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "w3c-html-validator", - "version": "1.1.0", + "version": "1.1.1", "description": "A package for testing HTML files or URLs against the W3C validator (written in functional TypeScript)", "license": "MIT", "type": "module",