w3c-html-validator 1.3.2 → 1.3.3
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.
- package/README.md +12 -6
- package/bin/cli.js +2 -2
- package/dist/w3c-html-validator.d.ts +1 -1
- package/dist/w3c-html-validator.js +3 -3
- package/dist/w3c-html-validator.umd.cjs +3 -3
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -63,18 +63,24 @@ Command-line flags:
|
|
|
63
63
|
Examples:
|
|
64
64
|
- `html-validator`<br>
|
|
65
65
|
Validate all HTML files in the project.
|
|
66
|
+
|
|
66
67
|
- `html-validator --exclude=build,tmp`<br>
|
|
67
68
|
Slip all files which have "build" or "tmp" anywhere in their pathname or filename.
|
|
68
|
-
|
|
69
|
+
|
|
70
|
+
- `html-validator docs/*.html '--ignore=Trailing slash on void elements'`<br>
|
|
69
71
|
Allow the ugly slashes of self-closing tags despite XHTML being a hideous scourge on the web.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
|
|
73
|
+
- `html-validator docs/*.html '--ignore=/^Duplicate ID/'`<br>
|
|
74
|
+
Use a RegEx (regular expression) to skip all validation messages that start with "Duplicate ID".
|
|
75
|
+
|
|
72
76
|
- `html-validator --quiet`<br>
|
|
73
|
-
Suppress "pass" messages.
|
|
77
|
+
Suppress "pass" status messages.
|
|
78
|
+
|
|
74
79
|
- `html-validator docs --delay=200`<br>
|
|
75
80
|
Validate all HTML files in the "docs" folder at a rate of 1 file per 200 ms (default is 500 ms).
|
|
81
|
+
|
|
76
82
|
- `html-validator docs --trim=30 --continue`<br>
|
|
77
|
-
Truncate messages to 30 characters and do not abort CI if validation fails.
|
|
83
|
+
Truncate validation messages to 30 characters and do not abort CI if validation fails.
|
|
78
84
|
|
|
79
85
|
## D) Application Code and Testing Frameworks
|
|
80
86
|
In addition to the CLI interface, the **w3c-html-validator** package can also be imported and called directly in ESM and TypeScript projects.
|
|
@@ -118,7 +124,7 @@ Option value `'warning'` also skips `'info'`.
|
|
|
118
124
|
| :--------------- | :---------- | :------ | :-------------------------------------------------------------- |
|
|
119
125
|
| `continueOnFail` | **boolean** | `false` | Report messages but do not throw an error if validation failed. |
|
|
120
126
|
| `maxMessageLen` | **number** | `null` | Trim validation messages to not exceed a maximum length. |
|
|
121
|
-
| `quiet` | **boolean** | `false` | Suppress messages for successful validations.
|
|
127
|
+
| `quiet` | **boolean** | `false` | Suppress status messages for successful validations. |
|
|
122
128
|
| `title` | **string** | `null` | Override display title (useful for naming HTML string inputs). |
|
|
123
129
|
|
|
124
130
|
### 3. TypeScript declarations
|
package/bin/cli.js
CHANGED
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
|
|
22
22
|
// Imports
|
|
23
23
|
import { cliArgvUtil } from 'cli-argv-util';
|
|
24
|
+
import { globSync } from 'glob';
|
|
24
25
|
import { w3cHtmlValidator } from '../dist/w3c-html-validator.js';
|
|
25
26
|
import chalk from 'chalk';
|
|
26
27
|
import fs from 'fs';
|
|
27
|
-
import glob from 'glob';
|
|
28
28
|
import log from 'fancy-log';
|
|
29
29
|
|
|
30
30
|
// Parameters and flags
|
|
@@ -37,7 +37,7 @@ const trim = parseInt(cli.flagMap.trim) || null;
|
|
|
37
37
|
|
|
38
38
|
// Validator
|
|
39
39
|
const keep = (filename) => !filename.includes('node_modules/');
|
|
40
|
-
const readFolder = (folder) =>
|
|
40
|
+
const readFolder = (folder) => globSync(folder + '**/*.html', { ignore: '**/node_modules/**/*' });
|
|
41
41
|
const expandFolder = (file) => fs.lstatSync(file).isDirectory() ? readFolder(file + '/') : file;
|
|
42
42
|
const getFilenames = () => [...new Set(files.map(expandFolder).flat().filter(keep))].sort();
|
|
43
43
|
const list = files.length ? getFilenames() : readFolder('');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
//! w3c-html-validator v1.3.
|
|
1
|
+
//! w3c-html-validator v1.3.3 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
|
|
2
2
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import log from 'fancy-log';
|
|
6
6
|
import request from 'superagent';
|
|
7
7
|
const w3cHtmlValidator = {
|
|
8
|
-
version: '1.3.
|
|
8
|
+
version: '1.3.3',
|
|
9
9
|
validate(options) {
|
|
10
10
|
var _a;
|
|
11
11
|
const defaults = {
|
|
@@ -102,7 +102,7 @@ const w3cHtmlValidator = {
|
|
|
102
102
|
};
|
|
103
103
|
const logMessage = (message) => {
|
|
104
104
|
var _a, _b, _c, _d;
|
|
105
|
-
const type = (_a = message.subType) !== null && _a !== void 0 ? _a : message.type;
|
|
105
|
+
const type = ((_a = message.subType) !== null && _a !== void 0 ? _a : message.type);
|
|
106
106
|
const typeColor = (_b = typeColorMap[type]) !== null && _b !== void 0 ? _b : chalk.redBright.bold;
|
|
107
107
|
const location = `line ${message.lastLine}, column ${message.firstColumn}:`;
|
|
108
108
|
const lineText = (_c = message.extract) === null || _c === void 0 ? void 0 : _c.replace(/\n/g, '\\n');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//! w3c-html-validator v1.3.
|
|
1
|
+
//! w3c-html-validator v1.3.3 ~~ 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,7 +20,7 @@ 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.3.
|
|
23
|
+
version: '1.3.3',
|
|
24
24
|
validate(options) {
|
|
25
25
|
var _a;
|
|
26
26
|
const defaults = {
|
|
@@ -117,7 +117,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
117
117
|
};
|
|
118
118
|
const logMessage = (message) => {
|
|
119
119
|
var _a, _b, _c, _d;
|
|
120
|
-
const type = (_a = message.subType) !== null && _a !== void 0 ? _a : message.type;
|
|
120
|
+
const type = ((_a = message.subType) !== null && _a !== void 0 ? _a : message.type);
|
|
121
121
|
const typeColor = (_b = typeColorMap[type]) !== null && _b !== void 0 ? _b : chalk_1.default.redBright.bold;
|
|
122
122
|
const location = `line ${message.lastLine}, column ${message.firstColumn}:`;
|
|
123
123
|
const lineText = (_c = message.extract) === null || _c === void 0 ? void 0 : _c.replace(/\n/g, '\\n');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "w3c-html-validator",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Check the markup validity of HTML files using the W3C validator",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"runScriptsConfig": {
|
|
65
65
|
"build": [
|
|
66
|
-
"rimraf build dist
|
|
66
|
+
"rimraf build dist",
|
|
67
67
|
"jshint . --exclude-path .gitignore",
|
|
68
68
|
"eslint --max-warnings 0 . --ext .ts",
|
|
69
69
|
"tsc",
|
|
@@ -79,28 +79,28 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"chalk": "~5.2",
|
|
82
|
-
"cli-argv-util": "~0
|
|
82
|
+
"cli-argv-util": "~1.0",
|
|
83
83
|
"fancy-log": "~2.0",
|
|
84
|
-
"glob": "~
|
|
84
|
+
"glob": "~9.3",
|
|
85
85
|
"superagent": "~8.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@types/fancy-log": "~2.0",
|
|
89
|
-
"@types/glob": "~8.
|
|
90
|
-
"@types/node": "~18.
|
|
89
|
+
"@types/glob": "~8.1",
|
|
90
|
+
"@types/node": "~18.15",
|
|
91
91
|
"@types/superagent": "~4.1",
|
|
92
|
-
"@typescript-eslint/eslint-plugin": "~5.
|
|
93
|
-
"@typescript-eslint/parser": "~5.
|
|
94
|
-
"add-dist-header": "~0
|
|
92
|
+
"@typescript-eslint/eslint-plugin": "~5.55",
|
|
93
|
+
"@typescript-eslint/parser": "~5.55",
|
|
94
|
+
"add-dist-header": "~1.0",
|
|
95
95
|
"assert-deep-strict-equal": "~1.0",
|
|
96
|
-
"copy-file-util": "~0
|
|
97
|
-
"copy-folder-util": "~0
|
|
98
|
-
"eslint": "~8.
|
|
96
|
+
"copy-file-util": "~1.0",
|
|
97
|
+
"copy-folder-util": "~1.0",
|
|
98
|
+
"eslint": "~8.36",
|
|
99
99
|
"jshint": "~2.13",
|
|
100
100
|
"merge-stream": "~2.0",
|
|
101
101
|
"mocha": "~10.2",
|
|
102
|
-
"rimraf": "
|
|
103
|
-
"run-scripts-util": "~0
|
|
104
|
-
"typescript": "~
|
|
102
|
+
"rimraf": "~4.4",
|
|
103
|
+
"run-scripts-util": "~1.0",
|
|
104
|
+
"typescript": "~5.0"
|
|
105
105
|
}
|
|
106
106
|
}
|