Skip to content

Commit

Permalink
Release v1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Apr 27, 2024
1 parent 3aedfdb commit f99ed38
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions dist/w3c-html-validator.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! w3c-html-validator v1.8.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
//! w3c-html-validator v1.8.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License

export type ValidatorSettings = {
html: string;
Expand All @@ -8,7 +8,7 @@ export type ValidatorSettings = {
ignoreLevel: 'info' | 'warning';
ignoreMessages: (string | RegExp)[];
output: ValidatorResultsOutput;
skip: boolean;
dryRun: boolean;
};
export type ValidatorResultsMessage = {
type: 'info' | 'error' | 'non-document-error' | 'network-error';
Expand All @@ -34,7 +34,7 @@ export type ValidatorResults = {
status: number;
messages: ValidatorResultsMessage[] | null;
display: string | null;
skip: boolean;
dryRun: boolean;
};
export type ValidatorResultsOutput = ValidatorResults['output'];
export type ReporterSettings = {
Expand All @@ -46,7 +46,7 @@ export type ReporterSettings = {
declare const w3cHtmlValidator: {
version: string;
validate(options: Partial<ValidatorSettings>): Promise<ValidatorResults>;
skipNotice(): void;
dryRunNotice(): void;
summary(numFiles: number): void;
reporter(results: ValidatorResults, options?: Partial<ReporterSettings>): ValidatorResults;
};
Expand Down
16 changes: 8 additions & 8 deletions dist/w3c-html-validator.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
//! w3c-html-validator v1.8.0 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License
//! w3c-html-validator v1.8.1 ~~ https://github.com/center-key/w3c-html-validator ~~ MIT License

import chalk from 'chalk';
import fs from 'fs';
import log from 'fancy-log';
import request from 'superagent';
import slash from 'slash';
const w3cHtmlValidator = {
version: '1.8.0',
version: '1.8.1',
validate(options) {
const defaults = {
checkUrl: 'https://validator.w3.org/nu/',
dryRun: false,
ignoreLevel: null,
ignoreMessages: [],
output: 'json',
skip: false,
};
const settings = { ...defaults, ...options };
if (!settings.html && !settings.filename && !settings.website)
Expand Down Expand Up @@ -61,7 +61,7 @@ const w3cHtmlValidator = {
status: response.statusCode || -1,
messages: json ? response.body.messages : null,
display: json ? null : response.text,
skip: settings.skip,
dryRun: settings.dryRun,
});
const handleError = (reason) => {
const errRes = reason.response ?? {};
Expand All @@ -73,14 +73,14 @@ const w3cHtmlValidator = {
const pseudoResponse = {
statusCode: 200,
body: { messages: [] },
text: 'Validation skipped.',
text: 'Validation bypassed.',
};
const pseudoRequest = () => new Promise(resolve => resolve(pseudoResponse));
const validation = settings.skip ? pseudoRequest() : w3cRequest;
const validation = settings.dryRun ? pseudoRequest() : w3cRequest;
return validation.then(filterMessages).then(toValidatorResults).catch(handleError);
},
skipNotice() {
log(chalk.gray('w3c-html-validator'), chalk.yellowBright('skip mode:'), chalk.whiteBright('validation being bypassed'));
dryRunNotice() {
log(chalk.gray('w3c-html-validator'), chalk.yellowBright('dry run mode:'), chalk.whiteBright('validation being bypassed'));
},
summary(numFiles) {
log(chalk.gray('w3c-html-validator'), chalk.magenta('files: ' + numFiles));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "w3c-html-validator",
"version": "1.8.0",
"version": "1.8.1",
"description": "Check the markup validity of HTML files using the W3C validator",
"license": "MIT",
"type": "module",
Expand Down

0 comments on commit f99ed38

Please sign in to comment.