w3c-html-validator 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- //! w3c-html-validator v1.1.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
1
+ //! w3c-html-validator v1.1.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
2
2
 
3
3
  export declare type ValidatorOptions = {
4
4
  html?: string;
@@ -1,12 +1,13 @@
1
- //! w3c-html-validator v1.1.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
1
+ //! w3c-html-validator v1.1.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
2
2
 
3
3
  import { readFileSync } from 'fs';
4
4
  import chalk from 'chalk';
5
5
  import log from 'fancy-log';
6
6
  import request from 'superagent';
7
7
  const w3cHtmlValidator = {
8
- version: '1.1.0',
8
+ version: '1.1.1',
9
9
  validate(options) {
10
+ var _a;
10
11
  const defaults = {
11
12
  checkUrl: 'https://validator.w3.org/nu/',
12
13
  ignoreLevel: null,
@@ -21,8 +22,8 @@ const w3cHtmlValidator = {
21
22
  if (settings.output !== 'json' && settings.output !== 'html')
22
23
  throw Error('[w3c-html-validator] Option "output" must be "json" or "html".');
23
24
  const mode = settings.html ? 'html' : settings.filename ? 'filename' : 'website';
24
- const readFile = () => settings.filename ? readFileSync(settings.filename, 'utf8') : null;
25
- const inputHtml = settings.html || readFile();
25
+ const readFile = (filename) => readFileSync(filename, 'utf8').replace(/\r/g, '');
26
+ const inputHtml = (_a = settings.html) !== null && _a !== void 0 ? _a : (settings.filename ? readFile(settings.filename) : null);
26
27
  const makePostRequest = () => request.post(settings.checkUrl)
27
28
  .set('Content-Type', 'text/html; encoding=utf-8')
28
29
  .send(inputHtml);
@@ -1,4 +1,4 @@
1
- //! w3c-html-validator v1.1.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
1
+ //! w3c-html-validator v1.1.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
2
2
 
3
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -20,8 +20,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20
20
  const fancy_log_1 = __importDefault(require("fancy-log"));
21
21
  const superagent_1 = __importDefault(require("superagent"));
22
22
  const w3cHtmlValidator = {
23
- version: '1.1.0',
23
+ version: '1.1.1',
24
24
  validate(options) {
25
+ var _a;
25
26
  const defaults = {
26
27
  checkUrl: 'https://validator.w3.org/nu/',
27
28
  ignoreLevel: null,
@@ -36,8 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
37
  if (settings.output !== 'json' && settings.output !== 'html')
37
38
  throw Error('[w3c-html-validator] Option "output" must be "json" or "html".');
38
39
  const mode = settings.html ? 'html' : settings.filename ? 'filename' : 'website';
39
- const readFile = () => settings.filename ? (0, fs_1.readFileSync)(settings.filename, 'utf8') : null;
40
- const inputHtml = settings.html || readFile();
40
+ const readFile = (filename) => (0, fs_1.readFileSync)(filename, 'utf8').replace(/\r/g, '');
41
+ const inputHtml = (_a = settings.html) !== null && _a !== void 0 ? _a : (settings.filename ? readFile(settings.filename) : null);
41
42
  const makePostRequest = () => superagent_1.default.post(settings.checkUrl)
42
43
  .set('Content-Type', 'text/html; encoding=utf-8')
43
44
  .send(inputHtml);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w3c-html-validator",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A package for testing HTML files or URLs against the W3C validator (written in functional TypeScript)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -80,20 +80,20 @@
80
80
  },
81
81
  "devDependencies": {
82
82
  "@types/fancy-log": "~2.0",
83
- "@types/glob": "~7.2",
84
- "@types/node": "~18.0",
83
+ "@types/glob": "~8.0",
84
+ "@types/node": "~18.7",
85
85
  "@types/superagent": "~4.1",
86
- "@typescript-eslint/eslint-plugin": "~5.30",
87
- "@typescript-eslint/parser": "~5.30",
88
- "add-dist-header": "~0.1",
86
+ "@typescript-eslint/eslint-plugin": "~5.37",
87
+ "@typescript-eslint/parser": "~5.37",
88
+ "add-dist-header": "~0.2",
89
89
  "assert-deep-strict-equal": "~1.0",
90
- "cpy-cli": "~4.1",
91
- "eslint": "~8.19",
90
+ "cpy-cli": "~4.2",
91
+ "eslint": "~8.23",
92
92
  "jshint": "~2.13",
93
93
  "merge-stream": "~2.0",
94
94
  "mocha": "~10.0",
95
95
  "npm-run-all2": "~6.0",
96
96
  "rimraf": "~3.0",
97
- "typescript": "~4.7"
97
+ "typescript": "~4.8"
98
98
  }
99
99
  }