@realfavicongenerator/check-favicon 0.4.8 → 0.4.18
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/dist/desktop/ico.js +4 -2
- package/dist/helper.d.ts +3 -1
- package/dist/helper.js +14 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/package.json +2 -2
- package/src/desktop/ico.ts +4 -3
- package/src/helper.ts +13 -1
- package/src/index.ts +1 -0
package/dist/desktop/ico.js
CHANGED
|
@@ -30,8 +30,10 @@ const checkIcoFavicon = (url, head, fetcher) => __awaiter(void 0, void 0, void 0
|
|
|
30
30
|
icon: { content: null, url: null, width: null, height: null }
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
const icos =
|
|
34
|
-
head.querySelectorAll('link[rel="icon"]
|
|
33
|
+
const icos = [
|
|
34
|
+
...head.querySelectorAll('link[rel="shortcut icon"]'),
|
|
35
|
+
...head.querySelectorAll('link[rel="icon"][type="image/x-icon"]')
|
|
36
|
+
];
|
|
35
37
|
let iconUrl = null;
|
|
36
38
|
let images;
|
|
37
39
|
if (icos.length === 0) {
|
package/dist/helper.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { Fetcher } from './types';
|
|
2
|
+
import { FaviconReport, Fetcher } from './types';
|
|
3
3
|
export declare const filePathToReadableStream: (path: string) => Promise<ReadableStream>;
|
|
4
4
|
export declare const filePathToString: (path: string) => Promise<string>;
|
|
5
5
|
export declare const stringToReadableStream: (str: string) => ReadableStream;
|
|
@@ -28,3 +28,5 @@ export declare const parseSizesAttribute: (sizes: string | undefined | null) =>
|
|
|
28
28
|
export declare const bufferToDataUrl: (buffer: Buffer, mimeType: string) => string;
|
|
29
29
|
export declare const filePathToDataUrl: (filePath: string) => Promise<string>;
|
|
30
30
|
export declare const fetchFetcher: Fetcher;
|
|
31
|
+
export declare const reportHasErrors: (report: FaviconReport) => boolean;
|
|
32
|
+
export declare const reportHasWarnings: (report: FaviconReport) => boolean;
|
package/dist/helper.js
CHANGED
|
@@ -12,8 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.fetchFetcher = exports.filePathToDataUrl = exports.bufferToDataUrl = exports.parseSizesAttribute = exports.mergeUrlAndPath = exports.checkIcon = exports.pathToMimeType = exports.readableStreamToBuffer = exports.readableStreamToString = exports.stringToReadableStream = exports.filePathToString = exports.filePathToReadableStream = void 0;
|
|
15
|
+
exports.reportHasWarnings = exports.reportHasErrors = exports.fetchFetcher = exports.filePathToDataUrl = exports.bufferToDataUrl = exports.parseSizesAttribute = exports.mergeUrlAndPath = exports.checkIcon = exports.pathToMimeType = exports.readableStreamToBuffer = exports.readableStreamToString = exports.stringToReadableStream = exports.filePathToString = exports.filePathToReadableStream = void 0;
|
|
16
16
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
17
|
+
const types_1 = require("./types");
|
|
17
18
|
const sharp_1 = __importDefault(require("sharp"));
|
|
18
19
|
const filePathToReadableStream = (path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
20
|
const file = yield promises_1.default.open(path, 'r');
|
|
@@ -210,3 +211,15 @@ const fetchFetcher = (url, contentType) => __awaiter(void 0, void 0, void 0, fun
|
|
|
210
211
|
};
|
|
211
212
|
});
|
|
212
213
|
exports.fetchFetcher = fetchFetcher;
|
|
214
|
+
const reportHasErrors = (report) => {
|
|
215
|
+
return report.desktop.messages.some(message => message.status === types_1.CheckerStatus.Error) ||
|
|
216
|
+
report.touchIcon.messages.some(message => message.status === types_1.CheckerStatus.Error) ||
|
|
217
|
+
report.webAppManifest.messages.some(message => message.status === types_1.CheckerStatus.Error);
|
|
218
|
+
};
|
|
219
|
+
exports.reportHasErrors = reportHasErrors;
|
|
220
|
+
const reportHasWarnings = (report) => {
|
|
221
|
+
return report.desktop.messages.some(message => message.status === types_1.CheckerStatus.Warning) ||
|
|
222
|
+
report.touchIcon.messages.some(message => message.status === types_1.CheckerStatus.Warning) ||
|
|
223
|
+
report.webAppManifest.messages.some(message => message.status === types_1.CheckerStatus.Warning);
|
|
224
|
+
};
|
|
225
|
+
exports.reportHasWarnings = reportHasWarnings;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { checkDesktopFavicon, checkSvgFavicon } from "./desktop/desktop";
|
|
|
3
3
|
export { checkTouchIcon } from "./touch-icon";
|
|
4
4
|
export { checkWebAppManifest } from "./web-app-manifest";
|
|
5
5
|
export { checkFavicon } from "./check";
|
|
6
|
+
export { reportHasErrors, reportHasWarnings } from "./helper";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkFavicon = exports.checkWebAppManifest = exports.checkTouchIcon = exports.checkSvgFavicon = exports.checkDesktopFavicon = exports.MessageId = exports.CheckerStatus = void 0;
|
|
3
|
+
exports.reportHasWarnings = exports.reportHasErrors = exports.checkFavicon = exports.checkWebAppManifest = exports.checkTouchIcon = exports.checkSvgFavicon = exports.checkDesktopFavicon = exports.MessageId = exports.CheckerStatus = void 0;
|
|
4
4
|
var types_1 = require("./types");
|
|
5
5
|
Object.defineProperty(exports, "CheckerStatus", { enumerable: true, get: function () { return types_1.CheckerStatus; } });
|
|
6
6
|
Object.defineProperty(exports, "MessageId", { enumerable: true, get: function () { return types_1.MessageId; } });
|
|
@@ -13,3 +13,6 @@ var web_app_manifest_1 = require("./web-app-manifest");
|
|
|
13
13
|
Object.defineProperty(exports, "checkWebAppManifest", { enumerable: true, get: function () { return web_app_manifest_1.checkWebAppManifest; } });
|
|
14
14
|
var check_1 = require("./check");
|
|
15
15
|
Object.defineProperty(exports, "checkFavicon", { enumerable: true, get: function () { return check_1.checkFavicon; } });
|
|
16
|
+
var helper_1 = require("./helper");
|
|
17
|
+
Object.defineProperty(exports, "reportHasErrors", { enumerable: true, get: function () { return helper_1.reportHasErrors; } });
|
|
18
|
+
Object.defineProperty(exports, "reportHasWarnings", { enumerable: true, get: function () { return helper_1.reportHasWarnings; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realfavicongenerator/check-favicon",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.18",
|
|
4
4
|
"description": "Check the favicon of a website",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"robots-parser": "^3.0.1",
|
|
41
41
|
"sharp": "^0.32.6"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "6d09c58437b7cd0c00c61fe38c278e8c28099c0a"
|
|
44
44
|
}
|
package/src/desktop/ico.ts
CHANGED
|
@@ -21,9 +21,10 @@ export const checkIcoFavicon = async (url: string, head: HTMLElement | null, fet
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const icos =
|
|
25
|
-
head.querySelectorAll('link[rel="shortcut icon"]')
|
|
26
|
-
head.querySelectorAll('link[rel="icon"][type="image/x-icon"]')
|
|
24
|
+
const icos = [
|
|
25
|
+
...head.querySelectorAll('link[rel="shortcut icon"]'),
|
|
26
|
+
...head.querySelectorAll('link[rel="icon"][type="image/x-icon"]')
|
|
27
|
+
];
|
|
27
28
|
|
|
28
29
|
let iconUrl: string | null = null;
|
|
29
30
|
let images;
|
package/src/helper.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs/promises'
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { Fetcher } from './types';
|
|
3
|
+
import { CheckerStatus, FaviconReport, Fetcher } from './types';
|
|
4
4
|
import sharp, { FormatEnum } from 'sharp';
|
|
5
5
|
|
|
6
6
|
export const filePathToReadableStream = async (path: string): Promise<ReadableStream> => {
|
|
@@ -231,3 +231,15 @@ export const fetchFetcher: Fetcher = async (url, contentType) => {
|
|
|
231
231
|
readableStream: res.body
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
+
|
|
235
|
+
export const reportHasErrors = (report: FaviconReport): boolean => {
|
|
236
|
+
return report.desktop.messages.some(message => message.status === CheckerStatus.Error) ||
|
|
237
|
+
report.touchIcon.messages.some(message => message.status === CheckerStatus.Error) ||
|
|
238
|
+
report.webAppManifest.messages.some(message => message.status === CheckerStatus.Error);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export const reportHasWarnings = (report: FaviconReport): boolean => {
|
|
242
|
+
return report.desktop.messages.some(message => message.status === CheckerStatus.Warning) ||
|
|
243
|
+
report.touchIcon.messages.some(message => message.status === CheckerStatus.Warning) ||
|
|
244
|
+
report.webAppManifest.messages.some(message => message.status === CheckerStatus.Warning);
|
|
245
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -15,3 +15,4 @@ export { checkDesktopFavicon, checkSvgFavicon } from "./desktop/desktop"
|
|
|
15
15
|
export { checkTouchIcon } from "./touch-icon"
|
|
16
16
|
export { checkWebAppManifest } from "./web-app-manifest"
|
|
17
17
|
export { checkFavicon } from "./check"
|
|
18
|
+
export { reportHasErrors, reportHasWarnings } from "./helper"
|