meodp 0.0.6 → 0.0.7
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 +1 -0
- package/bin/index.mjs +0 -0
- package/dist/cli/index.cjs +168 -18
- package/dist/cli/index.mjs +154 -7
- package/dist/index.cjs +39 -37
- package/dist/index.d.cts +87 -3
- package/dist/index.d.mts +87 -3
- package/dist/index.d.ts +87 -3
- package/dist/index.mjs +9 -8
- package/dist/shared/{meodp.9c5df07b.mjs → meodp.5489574b.mjs} +275 -186
- package/dist/shared/{meodp.c2959ba5.cjs → meodp.9bf8b8ff.cjs} +280 -190
- package/package.json +6 -2
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import * as PQueue from 'p-queue';
|
|
|
2
2
|
import PQueue__default from 'p-queue';
|
|
3
3
|
import * as playwright from 'playwright';
|
|
4
4
|
import { Response, Request, Page } from 'playwright';
|
|
5
|
+
import * as lowdb from 'lowdb';
|
|
5
6
|
import winston from 'winston';
|
|
6
7
|
import cliProgress from 'cli-progress';
|
|
7
8
|
|
|
@@ -17,7 +18,7 @@ declare const siteUrlMap: Map<string, {
|
|
|
17
18
|
/**
|
|
18
19
|
* 检查状态
|
|
19
20
|
*/
|
|
20
|
-
checkStatus: "pending" | "passed" | "failed" | "goto";
|
|
21
|
+
checkStatus: "pending" | "passed" | "failed" | "goto" | "ignored";
|
|
21
22
|
}>;
|
|
22
23
|
/**
|
|
23
24
|
* site p-queue
|
|
@@ -170,6 +171,86 @@ interface MEODPConfig {
|
|
|
170
171
|
*/
|
|
171
172
|
declare function checkLink(urlItem: MEODPUrlProps): Promise<void>;
|
|
172
173
|
|
|
174
|
+
/**
|
|
175
|
+
* 站点中的链接
|
|
176
|
+
*/
|
|
177
|
+
interface MEODPSiteLinkItem {
|
|
178
|
+
url: string;
|
|
179
|
+
title?: string;
|
|
180
|
+
statusCode: number;
|
|
181
|
+
statusText?: string;
|
|
182
|
+
checkStatus: 'pending' | 'passed' | 'failed' | 'goto' | 'ignored' | 'timeout';
|
|
183
|
+
/**
|
|
184
|
+
* success requests
|
|
185
|
+
*/
|
|
186
|
+
success: number;
|
|
187
|
+
/**
|
|
188
|
+
* failed requests
|
|
189
|
+
*/
|
|
190
|
+
failed: number;
|
|
191
|
+
timeout: number;
|
|
192
|
+
/**
|
|
193
|
+
* ignored requests
|
|
194
|
+
*/
|
|
195
|
+
ignored: number;
|
|
196
|
+
/**
|
|
197
|
+
* duration in ms
|
|
198
|
+
*/
|
|
199
|
+
duration: number;
|
|
200
|
+
/**
|
|
201
|
+
* total requests
|
|
202
|
+
*/
|
|
203
|
+
total: number;
|
|
204
|
+
requests: MEODPRequestItem[];
|
|
205
|
+
}
|
|
206
|
+
interface MEODPRequestItem {
|
|
207
|
+
/**
|
|
208
|
+
* @desc 是否失败
|
|
209
|
+
*/
|
|
210
|
+
failed?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* @desc 是否被忽略
|
|
213
|
+
*/
|
|
214
|
+
ignored?: boolean;
|
|
215
|
+
url?: string;
|
|
216
|
+
statusCode?: number;
|
|
217
|
+
statusText?: string;
|
|
218
|
+
}
|
|
219
|
+
interface MEODPSiteItem {
|
|
220
|
+
/**
|
|
221
|
+
* @desc 站点名称
|
|
222
|
+
*/
|
|
223
|
+
name?: string;
|
|
224
|
+
/**
|
|
225
|
+
* url 内容为 html 时,将会检查页面上的所有资源
|
|
226
|
+
*/
|
|
227
|
+
url: string;
|
|
228
|
+
/**
|
|
229
|
+
* @desc 站点标题
|
|
230
|
+
*/
|
|
231
|
+
title?: string;
|
|
232
|
+
/**
|
|
233
|
+
* site links 站点其他链接
|
|
234
|
+
*/
|
|
235
|
+
links: MEODPSiteLinkItem[];
|
|
236
|
+
/**
|
|
237
|
+
* 本次总体检查状态
|
|
238
|
+
*/
|
|
239
|
+
checkStatus: 'passed' | 'failed' | 'pending';
|
|
240
|
+
/**
|
|
241
|
+
* all ignored urls
|
|
242
|
+
*/
|
|
243
|
+
ignored: string[];
|
|
244
|
+
}
|
|
245
|
+
interface DBData {
|
|
246
|
+
config: MEODPConfig;
|
|
247
|
+
sites: Record<string, MEODPSiteItem>;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* create json db
|
|
251
|
+
*/
|
|
252
|
+
declare function createLowDB(rootDir?: string): Promise<lowdb.Low<DBData>>;
|
|
253
|
+
|
|
173
254
|
/**
|
|
174
255
|
* 获取站点外链
|
|
175
256
|
*/
|
|
@@ -190,7 +271,7 @@ interface CheckSiteUrlOptions {
|
|
|
190
271
|
* check url in site
|
|
191
272
|
* @param url
|
|
192
273
|
*/
|
|
193
|
-
declare function checkSiteUrl(url: string, options: CheckSiteUrlOptions): Promise<
|
|
274
|
+
declare function checkSiteUrl(url: string, options: CheckSiteUrlOptions): Promise<MEODPSiteLinkItem | undefined>;
|
|
194
275
|
/**
|
|
195
276
|
* 检查站点可访问性
|
|
196
277
|
* - 死链
|
|
@@ -310,6 +391,9 @@ declare function getFormattedDuration(duration: number): string;
|
|
|
310
391
|
* get formatted data from response
|
|
311
392
|
*/
|
|
312
393
|
declare function getFormattedDataFromResponse(res: Response): {
|
|
394
|
+
/**
|
|
395
|
+
* 四舍五入 ms
|
|
396
|
+
*/
|
|
313
397
|
duration: number;
|
|
314
398
|
durationText: string;
|
|
315
399
|
statusCode: number;
|
|
@@ -359,4 +443,4 @@ declare function getMEODPUrlItemInfo(urlItem: MEODPUrlItem): {
|
|
|
359
443
|
emoji: string;
|
|
360
444
|
};
|
|
361
445
|
|
|
362
|
-
export { type CheckSiteUrlOptions, LocalLog, type LocalLogOptions, type MEODPConfig, type MEODPUrlItem, type MEODPUrlProps, type MEODPUrlType, PQueueMap, type PageUrlEvent, type UrlCategoryInfo, type UrlMap, checkLink, checkMEODPUrl, checkSite, checkSiteMap, checkSiteUrl, checkUrlNomoduleAssets, createMEODPLogger, createWinstonLogger, defaultMEODPConfig, defineConfig, emojiMap, formatArgs, getBrowser, getFormattedDataFromResponse, getFormattedDuration, getMEODPUrlItemInfo, getSiteLinks, isLink, localLog, logUrlItemInfo, multiBar, parseUrlMap, progressBarMap, registerPageEvents, runByConfig, siteUrlMap };
|
|
446
|
+
export { type CheckSiteUrlOptions, type DBData, LocalLog, type LocalLogOptions, type MEODPConfig, type MEODPRequestItem, type MEODPSiteItem, type MEODPSiteLinkItem, type MEODPUrlItem, type MEODPUrlProps, type MEODPUrlType, PQueueMap, type PageUrlEvent, type UrlCategoryInfo, type UrlMap, checkLink, checkMEODPUrl, checkSite, checkSiteMap, checkSiteUrl, checkUrlNomoduleAssets, createLowDB, createMEODPLogger, createWinstonLogger, defaultMEODPConfig, defineConfig, emojiMap, formatArgs, getBrowser, getFormattedDataFromResponse, getFormattedDuration, getMEODPUrlItemInfo, getSiteLinks, isLink, localLog, logUrlItemInfo, multiBar, parseUrlMap, progressBarMap, registerPageEvents, runByConfig, siteUrlMap };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as PQueue from 'p-queue';
|
|
|
2
2
|
import PQueue__default from 'p-queue';
|
|
3
3
|
import * as playwright from 'playwright';
|
|
4
4
|
import { Response, Request, Page } from 'playwright';
|
|
5
|
+
import * as lowdb from 'lowdb';
|
|
5
6
|
import winston from 'winston';
|
|
6
7
|
import cliProgress from 'cli-progress';
|
|
7
8
|
|
|
@@ -17,7 +18,7 @@ declare const siteUrlMap: Map<string, {
|
|
|
17
18
|
/**
|
|
18
19
|
* 检查状态
|
|
19
20
|
*/
|
|
20
|
-
checkStatus: "pending" | "passed" | "failed" | "goto";
|
|
21
|
+
checkStatus: "pending" | "passed" | "failed" | "goto" | "ignored";
|
|
21
22
|
}>;
|
|
22
23
|
/**
|
|
23
24
|
* site p-queue
|
|
@@ -170,6 +171,86 @@ interface MEODPConfig {
|
|
|
170
171
|
*/
|
|
171
172
|
declare function checkLink(urlItem: MEODPUrlProps): Promise<void>;
|
|
172
173
|
|
|
174
|
+
/**
|
|
175
|
+
* 站点中的链接
|
|
176
|
+
*/
|
|
177
|
+
interface MEODPSiteLinkItem {
|
|
178
|
+
url: string;
|
|
179
|
+
title?: string;
|
|
180
|
+
statusCode: number;
|
|
181
|
+
statusText?: string;
|
|
182
|
+
checkStatus: 'pending' | 'passed' | 'failed' | 'goto' | 'ignored' | 'timeout';
|
|
183
|
+
/**
|
|
184
|
+
* success requests
|
|
185
|
+
*/
|
|
186
|
+
success: number;
|
|
187
|
+
/**
|
|
188
|
+
* failed requests
|
|
189
|
+
*/
|
|
190
|
+
failed: number;
|
|
191
|
+
timeout: number;
|
|
192
|
+
/**
|
|
193
|
+
* ignored requests
|
|
194
|
+
*/
|
|
195
|
+
ignored: number;
|
|
196
|
+
/**
|
|
197
|
+
* duration in ms
|
|
198
|
+
*/
|
|
199
|
+
duration: number;
|
|
200
|
+
/**
|
|
201
|
+
* total requests
|
|
202
|
+
*/
|
|
203
|
+
total: number;
|
|
204
|
+
requests: MEODPRequestItem[];
|
|
205
|
+
}
|
|
206
|
+
interface MEODPRequestItem {
|
|
207
|
+
/**
|
|
208
|
+
* @desc 是否失败
|
|
209
|
+
*/
|
|
210
|
+
failed?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* @desc 是否被忽略
|
|
213
|
+
*/
|
|
214
|
+
ignored?: boolean;
|
|
215
|
+
url?: string;
|
|
216
|
+
statusCode?: number;
|
|
217
|
+
statusText?: string;
|
|
218
|
+
}
|
|
219
|
+
interface MEODPSiteItem {
|
|
220
|
+
/**
|
|
221
|
+
* @desc 站点名称
|
|
222
|
+
*/
|
|
223
|
+
name?: string;
|
|
224
|
+
/**
|
|
225
|
+
* url 内容为 html 时,将会检查页面上的所有资源
|
|
226
|
+
*/
|
|
227
|
+
url: string;
|
|
228
|
+
/**
|
|
229
|
+
* @desc 站点标题
|
|
230
|
+
*/
|
|
231
|
+
title?: string;
|
|
232
|
+
/**
|
|
233
|
+
* site links 站点其他链接
|
|
234
|
+
*/
|
|
235
|
+
links: MEODPSiteLinkItem[];
|
|
236
|
+
/**
|
|
237
|
+
* 本次总体检查状态
|
|
238
|
+
*/
|
|
239
|
+
checkStatus: 'passed' | 'failed' | 'pending';
|
|
240
|
+
/**
|
|
241
|
+
* all ignored urls
|
|
242
|
+
*/
|
|
243
|
+
ignored: string[];
|
|
244
|
+
}
|
|
245
|
+
interface DBData {
|
|
246
|
+
config: MEODPConfig;
|
|
247
|
+
sites: Record<string, MEODPSiteItem>;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* create json db
|
|
251
|
+
*/
|
|
252
|
+
declare function createLowDB(rootDir?: string): Promise<lowdb.Low<DBData>>;
|
|
253
|
+
|
|
173
254
|
/**
|
|
174
255
|
* 获取站点外链
|
|
175
256
|
*/
|
|
@@ -190,7 +271,7 @@ interface CheckSiteUrlOptions {
|
|
|
190
271
|
* check url in site
|
|
191
272
|
* @param url
|
|
192
273
|
*/
|
|
193
|
-
declare function checkSiteUrl(url: string, options: CheckSiteUrlOptions): Promise<
|
|
274
|
+
declare function checkSiteUrl(url: string, options: CheckSiteUrlOptions): Promise<MEODPSiteLinkItem | undefined>;
|
|
194
275
|
/**
|
|
195
276
|
* 检查站点可访问性
|
|
196
277
|
* - 死链
|
|
@@ -310,6 +391,9 @@ declare function getFormattedDuration(duration: number): string;
|
|
|
310
391
|
* get formatted data from response
|
|
311
392
|
*/
|
|
312
393
|
declare function getFormattedDataFromResponse(res: Response): {
|
|
394
|
+
/**
|
|
395
|
+
* 四舍五入 ms
|
|
396
|
+
*/
|
|
313
397
|
duration: number;
|
|
314
398
|
durationText: string;
|
|
315
399
|
statusCode: number;
|
|
@@ -359,4 +443,4 @@ declare function getMEODPUrlItemInfo(urlItem: MEODPUrlItem): {
|
|
|
359
443
|
emoji: string;
|
|
360
444
|
};
|
|
361
445
|
|
|
362
|
-
export { type CheckSiteUrlOptions, LocalLog, type LocalLogOptions, type MEODPConfig, type MEODPUrlItem, type MEODPUrlProps, type MEODPUrlType, PQueueMap, type PageUrlEvent, type UrlCategoryInfo, type UrlMap, checkLink, checkMEODPUrl, checkSite, checkSiteMap, checkSiteUrl, checkUrlNomoduleAssets, createMEODPLogger, createWinstonLogger, defaultMEODPConfig, defineConfig, emojiMap, formatArgs, getBrowser, getFormattedDataFromResponse, getFormattedDuration, getMEODPUrlItemInfo, getSiteLinks, isLink, localLog, logUrlItemInfo, multiBar, parseUrlMap, progressBarMap, registerPageEvents, runByConfig, siteUrlMap };
|
|
446
|
+
export { type CheckSiteUrlOptions, type DBData, LocalLog, type LocalLogOptions, type MEODPConfig, type MEODPRequestItem, type MEODPSiteItem, type MEODPSiteLinkItem, type MEODPUrlItem, type MEODPUrlProps, type MEODPUrlType, PQueueMap, type PageUrlEvent, type UrlCategoryInfo, type UrlMap, checkLink, checkMEODPUrl, checkSite, checkSiteMap, checkSiteUrl, checkUrlNomoduleAssets, createLowDB, createMEODPLogger, createWinstonLogger, defaultMEODPConfig, defineConfig, emojiMap, formatArgs, getBrowser, getFormattedDataFromResponse, getFormattedDuration, getMEODPUrlItemInfo, getSiteLinks, isLink, localLog, logUrlItemInfo, multiBar, parseUrlMap, progressBarMap, registerPageEvents, runByConfig, siteUrlMap };
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { g as getBrowser, s as siteUrlMap } from './shared/meodp.
|
|
2
|
-
export { L as LocalLog, P as PQueueMap, a as checkLink, c as checkMEODPUrl, f as checkSite, e as checkSiteUrl, d as checkUrlNomoduleAssets,
|
|
3
|
-
import 'consola';
|
|
4
|
-
import 'p-queue';
|
|
1
|
+
import { g as getBrowser, s as siteUrlMap } from './shared/meodp.5489574b.mjs';
|
|
2
|
+
export { L as LocalLog, P as PQueueMap, a as checkLink, c as checkMEODPUrl, f as checkSite, e as checkSiteUrl, d as checkUrlNomoduleAssets, j as createLowDB, m as createMEODPLogger, n as createWinstonLogger, h as defaultMEODPConfig, i as defineConfig, y as emojiMap, t as formatArgs, v as getFormattedDataFromResponse, u as getFormattedDuration, z as getMEODPUrlItemInfo, b as getSiteLinks, w as isLink, k as localLog, l as logUrlItemInfo, o as multiBar, x as parseUrlMap, p as progressBarMap, q as registerPageEvents, r as runByConfig } from './shared/meodp.5489574b.mjs';
|
|
5
3
|
import 'consola/utils';
|
|
6
4
|
import 'playwright';
|
|
7
5
|
import 'node:path';
|
|
8
6
|
import 'node:process';
|
|
9
|
-
import '
|
|
10
|
-
import '
|
|
11
|
-
import '
|
|
12
|
-
import 'winston';
|
|
7
|
+
import 'consola';
|
|
8
|
+
import 'lowdb/node';
|
|
9
|
+
import 'p-queue';
|
|
13
10
|
import 'cli-progress';
|
|
14
11
|
import 'cli-progress/lib/options.js';
|
|
15
12
|
import 'cli-progress/lib/format-bar.js';
|
|
16
13
|
import 'cli-progress/lib/format-time.js';
|
|
14
|
+
import 'date-fns';
|
|
15
|
+
import 'fs-extra';
|
|
16
|
+
import 'strip-ansi';
|
|
17
|
+
import 'winston';
|
|
17
18
|
|
|
18
19
|
async function checkSiteMap(urlItem) {
|
|
19
20
|
const { url } = urlItem;
|