meodp 0.0.8 → 0.1.0
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 +204 -22
- package/bin/index.mjs +10 -2
- package/dist/check/cli.cjs +166 -0
- package/dist/check/cli.d.cts +5 -0
- package/dist/check/cli.d.mts +5 -0
- package/dist/check/cli.d.ts +5 -0
- package/dist/check/cli.mjs +158 -0
- package/dist/check/index.cjs +25 -0
- package/dist/check/index.d.cts +107 -0
- package/dist/check/index.d.mts +107 -0
- package/dist/check/index.d.ts +107 -0
- package/dist/check/index.mjs +11 -0
- package/dist/cli/index.cjs +5 -5
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.mts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.mjs +5 -5
- package/dist/cli/main.cjs +220 -0
- package/dist/cli/main.d.cts +4 -0
- package/dist/cli/main.d.mts +4 -0
- package/dist/cli/main.d.ts +4 -0
- package/dist/cli/main.mjs +214 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/shared/{meodp.6b19529e.cjs → meodp.15f2977d.cjs} +1 -1
- package/dist/shared/{meodp.b58178b8.mjs → meodp.9a096f50.mjs} +1 -1
- package/dist/shared/meodp.a0bcc3e7.cjs +580 -0
- package/dist/shared/meodp.d0916bc5.mjs +569 -0
- package/package.json +58 -31
- package/bin/index.ts +0 -6
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
interface LinkTarget {
|
|
2
|
+
url: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
}
|
|
5
|
+
type Availability = 'reachable' | 'restricted' | 'unavailable';
|
|
6
|
+
type FailureReason = 'http' | 'dns' | 'tls' | 'timeout' | 'network' | 'redirect';
|
|
7
|
+
interface LinkObservation extends LinkTarget {
|
|
8
|
+
status: Availability;
|
|
9
|
+
checkedAt: string;
|
|
10
|
+
durationMs: number;
|
|
11
|
+
attempts: number;
|
|
12
|
+
finalUrl: string;
|
|
13
|
+
httpStatus?: number;
|
|
14
|
+
redirects: {
|
|
15
|
+
url: string;
|
|
16
|
+
status: number;
|
|
17
|
+
location: string;
|
|
18
|
+
}[];
|
|
19
|
+
reason?: FailureReason;
|
|
20
|
+
detail?: string;
|
|
21
|
+
consecutiveFailures: number;
|
|
22
|
+
firstFailureAt?: string;
|
|
23
|
+
lastSuccessAt?: string;
|
|
24
|
+
changed: boolean;
|
|
25
|
+
recovered: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface CheckReport {
|
|
28
|
+
schemaVersion: 1;
|
|
29
|
+
observer: string;
|
|
30
|
+
startedAt: string;
|
|
31
|
+
completedAt: string;
|
|
32
|
+
summary: Record<Availability, number> & {
|
|
33
|
+
total: number;
|
|
34
|
+
redirected: number;
|
|
35
|
+
recovered: number;
|
|
36
|
+
};
|
|
37
|
+
results: LinkObservation[];
|
|
38
|
+
}
|
|
39
|
+
interface CheckOptions {
|
|
40
|
+
/** Maximum simultaneous site checks. Default: 5. */
|
|
41
|
+
concurrency?: number;
|
|
42
|
+
/** Timeout for each HTTP request, including its body. Default: 10000 ms. */
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
/** Retries for transport errors and 5xx responses. Default: 1; 429 is not retried. */
|
|
45
|
+
retries?: number;
|
|
46
|
+
/** Maximum followed redirects per attempt. Default: 5. */
|
|
47
|
+
maxRedirects?: number;
|
|
48
|
+
/** Identifies the network/environment. Must match previousReport.observer. */
|
|
49
|
+
observer?: string;
|
|
50
|
+
previousReport?: CheckReport;
|
|
51
|
+
onResult?: (result: LinkObservation) => void | Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
interface SitemapOptions extends CheckOptions {
|
|
54
|
+
/** Treat the input as a site URL: read robots.txt, falling back to /sitemap.xml. */
|
|
55
|
+
discover?: boolean;
|
|
56
|
+
/** Reject before page checks if discovery exceeds this many unique pages. Default: 10000. */
|
|
57
|
+
maxUrls?: number;
|
|
58
|
+
/** Maximum number of unique sitemap documents to read. Default: 100. */
|
|
59
|
+
maxSitemaps?: number;
|
|
60
|
+
/** Maximum downloaded and decompressed size per discovery document. Default: 10 MiB. */
|
|
61
|
+
maxSitemapBytes?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Check only the supplied URLs. HTTP failures become observations; invalid input rejects. */
|
|
65
|
+
declare function checkLinks(input: readonly (string | LinkTarget)[], options?: CheckOptions): Promise<CheckReport>;
|
|
66
|
+
|
|
67
|
+
interface ReportSiteOptions {
|
|
68
|
+
/** Automatically load this HTTP(S) or relative JSON URL when hosted. */
|
|
69
|
+
dataUrl?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
declare function formatReport(report: CheckReport, format?: 'json' | 'markdown' | 'html'): string;
|
|
73
|
+
declare function writeReports(report: CheckReport, directory: string): Promise<{
|
|
74
|
+
json: string;
|
|
75
|
+
markdown: string;
|
|
76
|
+
html: string;
|
|
77
|
+
}>;
|
|
78
|
+
/** Export a portable static site. Hosting refreshes the sidecar; file:// uses the embedded snapshot. */
|
|
79
|
+
declare function writeReportSite(report: CheckReport | undefined, directory: string, options?: ReportSiteOptions): Promise<{
|
|
80
|
+
index: string;
|
|
81
|
+
json?: string;
|
|
82
|
+
}>;
|
|
83
|
+
/** A missing file starts history; malformed or incompatible history is an error. */
|
|
84
|
+
declare function readReport(path: string): Promise<CheckReport | undefined>;
|
|
85
|
+
/** Write history only after a completed run; replace it atomically. */
|
|
86
|
+
declare function saveReport(report: CheckReport, path: string): Promise<void>;
|
|
87
|
+
|
|
88
|
+
/** Shared by the Node reader and the static viewer; report files are untrusted input. */
|
|
89
|
+
declare function parseReport(data: unknown): CheckReport;
|
|
90
|
+
|
|
91
|
+
/** Read and validate a complete, deduplicated page list without requesting the pages. */
|
|
92
|
+
declare function readSitemapUrls(source: string, options?: SitemapOptions): Promise<string[]>;
|
|
93
|
+
/** Check sitemap-listed pages using the same linkinator adapter, history, and report schema as checkLinks. */
|
|
94
|
+
declare function checkSitemap(source: string, options?: SitemapOptions): Promise<{
|
|
95
|
+
startedAt: string;
|
|
96
|
+
schemaVersion: 1;
|
|
97
|
+
observer: string;
|
|
98
|
+
completedAt: string;
|
|
99
|
+
summary: Record<Availability, number> & {
|
|
100
|
+
total: number;
|
|
101
|
+
redirected: number;
|
|
102
|
+
recovered: number;
|
|
103
|
+
};
|
|
104
|
+
results: LinkObservation[];
|
|
105
|
+
}>;
|
|
106
|
+
|
|
107
|
+
export { type Availability, type CheckOptions, type CheckReport, type FailureReason, type LinkObservation, type LinkTarget, type ReportSiteOptions, type SitemapOptions, checkLinks, checkSitemap, formatReport, parseReport, readReport, readSitemapUrls, saveReport, writeReportSite, writeReports };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
interface LinkTarget {
|
|
2
|
+
url: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
}
|
|
5
|
+
type Availability = 'reachable' | 'restricted' | 'unavailable';
|
|
6
|
+
type FailureReason = 'http' | 'dns' | 'tls' | 'timeout' | 'network' | 'redirect';
|
|
7
|
+
interface LinkObservation extends LinkTarget {
|
|
8
|
+
status: Availability;
|
|
9
|
+
checkedAt: string;
|
|
10
|
+
durationMs: number;
|
|
11
|
+
attempts: number;
|
|
12
|
+
finalUrl: string;
|
|
13
|
+
httpStatus?: number;
|
|
14
|
+
redirects: {
|
|
15
|
+
url: string;
|
|
16
|
+
status: number;
|
|
17
|
+
location: string;
|
|
18
|
+
}[];
|
|
19
|
+
reason?: FailureReason;
|
|
20
|
+
detail?: string;
|
|
21
|
+
consecutiveFailures: number;
|
|
22
|
+
firstFailureAt?: string;
|
|
23
|
+
lastSuccessAt?: string;
|
|
24
|
+
changed: boolean;
|
|
25
|
+
recovered: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface CheckReport {
|
|
28
|
+
schemaVersion: 1;
|
|
29
|
+
observer: string;
|
|
30
|
+
startedAt: string;
|
|
31
|
+
completedAt: string;
|
|
32
|
+
summary: Record<Availability, number> & {
|
|
33
|
+
total: number;
|
|
34
|
+
redirected: number;
|
|
35
|
+
recovered: number;
|
|
36
|
+
};
|
|
37
|
+
results: LinkObservation[];
|
|
38
|
+
}
|
|
39
|
+
interface CheckOptions {
|
|
40
|
+
/** Maximum simultaneous site checks. Default: 5. */
|
|
41
|
+
concurrency?: number;
|
|
42
|
+
/** Timeout for each HTTP request, including its body. Default: 10000 ms. */
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
/** Retries for transport errors and 5xx responses. Default: 1; 429 is not retried. */
|
|
45
|
+
retries?: number;
|
|
46
|
+
/** Maximum followed redirects per attempt. Default: 5. */
|
|
47
|
+
maxRedirects?: number;
|
|
48
|
+
/** Identifies the network/environment. Must match previousReport.observer. */
|
|
49
|
+
observer?: string;
|
|
50
|
+
previousReport?: CheckReport;
|
|
51
|
+
onResult?: (result: LinkObservation) => void | Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
interface SitemapOptions extends CheckOptions {
|
|
54
|
+
/** Treat the input as a site URL: read robots.txt, falling back to /sitemap.xml. */
|
|
55
|
+
discover?: boolean;
|
|
56
|
+
/** Reject before page checks if discovery exceeds this many unique pages. Default: 10000. */
|
|
57
|
+
maxUrls?: number;
|
|
58
|
+
/** Maximum number of unique sitemap documents to read. Default: 100. */
|
|
59
|
+
maxSitemaps?: number;
|
|
60
|
+
/** Maximum downloaded and decompressed size per discovery document. Default: 10 MiB. */
|
|
61
|
+
maxSitemapBytes?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Check only the supplied URLs. HTTP failures become observations; invalid input rejects. */
|
|
65
|
+
declare function checkLinks(input: readonly (string | LinkTarget)[], options?: CheckOptions): Promise<CheckReport>;
|
|
66
|
+
|
|
67
|
+
interface ReportSiteOptions {
|
|
68
|
+
/** Automatically load this HTTP(S) or relative JSON URL when hosted. */
|
|
69
|
+
dataUrl?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
declare function formatReport(report: CheckReport, format?: 'json' | 'markdown' | 'html'): string;
|
|
73
|
+
declare function writeReports(report: CheckReport, directory: string): Promise<{
|
|
74
|
+
json: string;
|
|
75
|
+
markdown: string;
|
|
76
|
+
html: string;
|
|
77
|
+
}>;
|
|
78
|
+
/** Export a portable static site. Hosting refreshes the sidecar; file:// uses the embedded snapshot. */
|
|
79
|
+
declare function writeReportSite(report: CheckReport | undefined, directory: string, options?: ReportSiteOptions): Promise<{
|
|
80
|
+
index: string;
|
|
81
|
+
json?: string;
|
|
82
|
+
}>;
|
|
83
|
+
/** A missing file starts history; malformed or incompatible history is an error. */
|
|
84
|
+
declare function readReport(path: string): Promise<CheckReport | undefined>;
|
|
85
|
+
/** Write history only after a completed run; replace it atomically. */
|
|
86
|
+
declare function saveReport(report: CheckReport, path: string): Promise<void>;
|
|
87
|
+
|
|
88
|
+
/** Shared by the Node reader and the static viewer; report files are untrusted input. */
|
|
89
|
+
declare function parseReport(data: unknown): CheckReport;
|
|
90
|
+
|
|
91
|
+
/** Read and validate a complete, deduplicated page list without requesting the pages. */
|
|
92
|
+
declare function readSitemapUrls(source: string, options?: SitemapOptions): Promise<string[]>;
|
|
93
|
+
/** Check sitemap-listed pages using the same linkinator adapter, history, and report schema as checkLinks. */
|
|
94
|
+
declare function checkSitemap(source: string, options?: SitemapOptions): Promise<{
|
|
95
|
+
startedAt: string;
|
|
96
|
+
schemaVersion: 1;
|
|
97
|
+
observer: string;
|
|
98
|
+
completedAt: string;
|
|
99
|
+
summary: Record<Availability, number> & {
|
|
100
|
+
total: number;
|
|
101
|
+
redirected: number;
|
|
102
|
+
recovered: number;
|
|
103
|
+
};
|
|
104
|
+
results: LinkObservation[];
|
|
105
|
+
}>;
|
|
106
|
+
|
|
107
|
+
export { type Availability, type CheckOptions, type CheckReport, type FailureReason, type LinkObservation, type LinkTarget, type ReportSiteOptions, type SitemapOptions, checkLinks, checkSitemap, formatReport, parseReport, readReport, readSitemapUrls, saveReport, writeReportSite, writeReports };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
interface LinkTarget {
|
|
2
|
+
url: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
}
|
|
5
|
+
type Availability = 'reachable' | 'restricted' | 'unavailable';
|
|
6
|
+
type FailureReason = 'http' | 'dns' | 'tls' | 'timeout' | 'network' | 'redirect';
|
|
7
|
+
interface LinkObservation extends LinkTarget {
|
|
8
|
+
status: Availability;
|
|
9
|
+
checkedAt: string;
|
|
10
|
+
durationMs: number;
|
|
11
|
+
attempts: number;
|
|
12
|
+
finalUrl: string;
|
|
13
|
+
httpStatus?: number;
|
|
14
|
+
redirects: {
|
|
15
|
+
url: string;
|
|
16
|
+
status: number;
|
|
17
|
+
location: string;
|
|
18
|
+
}[];
|
|
19
|
+
reason?: FailureReason;
|
|
20
|
+
detail?: string;
|
|
21
|
+
consecutiveFailures: number;
|
|
22
|
+
firstFailureAt?: string;
|
|
23
|
+
lastSuccessAt?: string;
|
|
24
|
+
changed: boolean;
|
|
25
|
+
recovered: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface CheckReport {
|
|
28
|
+
schemaVersion: 1;
|
|
29
|
+
observer: string;
|
|
30
|
+
startedAt: string;
|
|
31
|
+
completedAt: string;
|
|
32
|
+
summary: Record<Availability, number> & {
|
|
33
|
+
total: number;
|
|
34
|
+
redirected: number;
|
|
35
|
+
recovered: number;
|
|
36
|
+
};
|
|
37
|
+
results: LinkObservation[];
|
|
38
|
+
}
|
|
39
|
+
interface CheckOptions {
|
|
40
|
+
/** Maximum simultaneous site checks. Default: 5. */
|
|
41
|
+
concurrency?: number;
|
|
42
|
+
/** Timeout for each HTTP request, including its body. Default: 10000 ms. */
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
/** Retries for transport errors and 5xx responses. Default: 1; 429 is not retried. */
|
|
45
|
+
retries?: number;
|
|
46
|
+
/** Maximum followed redirects per attempt. Default: 5. */
|
|
47
|
+
maxRedirects?: number;
|
|
48
|
+
/** Identifies the network/environment. Must match previousReport.observer. */
|
|
49
|
+
observer?: string;
|
|
50
|
+
previousReport?: CheckReport;
|
|
51
|
+
onResult?: (result: LinkObservation) => void | Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
interface SitemapOptions extends CheckOptions {
|
|
54
|
+
/** Treat the input as a site URL: read robots.txt, falling back to /sitemap.xml. */
|
|
55
|
+
discover?: boolean;
|
|
56
|
+
/** Reject before page checks if discovery exceeds this many unique pages. Default: 10000. */
|
|
57
|
+
maxUrls?: number;
|
|
58
|
+
/** Maximum number of unique sitemap documents to read. Default: 100. */
|
|
59
|
+
maxSitemaps?: number;
|
|
60
|
+
/** Maximum downloaded and decompressed size per discovery document. Default: 10 MiB. */
|
|
61
|
+
maxSitemapBytes?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Check only the supplied URLs. HTTP failures become observations; invalid input rejects. */
|
|
65
|
+
declare function checkLinks(input: readonly (string | LinkTarget)[], options?: CheckOptions): Promise<CheckReport>;
|
|
66
|
+
|
|
67
|
+
interface ReportSiteOptions {
|
|
68
|
+
/** Automatically load this HTTP(S) or relative JSON URL when hosted. */
|
|
69
|
+
dataUrl?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
declare function formatReport(report: CheckReport, format?: 'json' | 'markdown' | 'html'): string;
|
|
73
|
+
declare function writeReports(report: CheckReport, directory: string): Promise<{
|
|
74
|
+
json: string;
|
|
75
|
+
markdown: string;
|
|
76
|
+
html: string;
|
|
77
|
+
}>;
|
|
78
|
+
/** Export a portable static site. Hosting refreshes the sidecar; file:// uses the embedded snapshot. */
|
|
79
|
+
declare function writeReportSite(report: CheckReport | undefined, directory: string, options?: ReportSiteOptions): Promise<{
|
|
80
|
+
index: string;
|
|
81
|
+
json?: string;
|
|
82
|
+
}>;
|
|
83
|
+
/** A missing file starts history; malformed or incompatible history is an error. */
|
|
84
|
+
declare function readReport(path: string): Promise<CheckReport | undefined>;
|
|
85
|
+
/** Write history only after a completed run; replace it atomically. */
|
|
86
|
+
declare function saveReport(report: CheckReport, path: string): Promise<void>;
|
|
87
|
+
|
|
88
|
+
/** Shared by the Node reader and the static viewer; report files are untrusted input. */
|
|
89
|
+
declare function parseReport(data: unknown): CheckReport;
|
|
90
|
+
|
|
91
|
+
/** Read and validate a complete, deduplicated page list without requesting the pages. */
|
|
92
|
+
declare function readSitemapUrls(source: string, options?: SitemapOptions): Promise<string[]>;
|
|
93
|
+
/** Check sitemap-listed pages using the same linkinator adapter, history, and report schema as checkLinks. */
|
|
94
|
+
declare function checkSitemap(source: string, options?: SitemapOptions): Promise<{
|
|
95
|
+
startedAt: string;
|
|
96
|
+
schemaVersion: 1;
|
|
97
|
+
observer: string;
|
|
98
|
+
completedAt: string;
|
|
99
|
+
summary: Record<Availability, number> & {
|
|
100
|
+
total: number;
|
|
101
|
+
redirected: number;
|
|
102
|
+
recovered: number;
|
|
103
|
+
};
|
|
104
|
+
results: LinkObservation[];
|
|
105
|
+
}>;
|
|
106
|
+
|
|
107
|
+
export { type Availability, type CheckOptions, type CheckReport, type FailureReason, type LinkObservation, type LinkTarget, type ReportSiteOptions, type SitemapOptions, checkLinks, checkSitemap, formatReport, parseReport, readReport, readSitemapUrls, saveReport, writeReportSite, writeReports };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { a as checkLinks, c as checkSitemap, f as formatReport, p as parseReport, r as readReport, d as readSitemapUrls, s as saveReport, b as writeReportSite, w as writeReports } from '../shared/meodp.d0916bc5.mjs';
|
|
2
|
+
import 'node:timers/promises';
|
|
3
|
+
import 'linkinator';
|
|
4
|
+
import 'node:os';
|
|
5
|
+
import 'node:crypto';
|
|
6
|
+
import 'node:fs/promises';
|
|
7
|
+
import 'node:path';
|
|
8
|
+
import 'node:buffer';
|
|
9
|
+
import 'node:util';
|
|
10
|
+
import 'node:zlib';
|
|
11
|
+
import 'fast-xml-parser';
|
package/dist/cli/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ const utils = require('consola/utils');
|
|
|
7
7
|
const yargs = require('yargs');
|
|
8
8
|
const helpers = require('yargs/helpers');
|
|
9
9
|
require('playwright');
|
|
10
|
-
const index = require('../shared/meodp.
|
|
10
|
+
const index = require('../shared/meodp.15f2977d.cjs');
|
|
11
11
|
require('node:path');
|
|
12
12
|
require('strip-ansi');
|
|
13
13
|
require('winston');
|
|
@@ -68,13 +68,13 @@ function getErrorMdContent(sites) {
|
|
|
68
68
|
continue;
|
|
69
69
|
}
|
|
70
70
|
const statusInfo = link.statusText ? `${link.statusCode} ${link.statusText}` : link.statusCode;
|
|
71
|
-
md += ` - [${statusInfo}]
|
|
71
|
+
md += ` - [${statusInfo}] [${link.url}](${link.url})
|
|
72
72
|
`;
|
|
73
73
|
for (const req of link.requests) {
|
|
74
74
|
if (req.failed) {
|
|
75
75
|
if (req.statusCode) {
|
|
76
76
|
const statusInfo2 = req.statusText ? `${req.statusCode} ${req.statusText}` : req.statusCode;
|
|
77
|
-
md += ` - [${statusInfo2}]
|
|
77
|
+
md += ` - [${statusInfo2}] [${req.url}](${req.url})
|
|
78
78
|
`;
|
|
79
79
|
} else {
|
|
80
80
|
md += ` - [\u23F0 TIMEOUT] <${req.url}>
|
|
@@ -235,8 +235,8 @@ const cli = yargs__default(helpers.hideBin(process__default$1.argv)).scriptName(
|
|
|
235
235
|
await output(argv.type);
|
|
236
236
|
}
|
|
237
237
|
).alias("h", "help").alias("v", "version").showHelpOnFail(false).help();
|
|
238
|
-
function run() {
|
|
239
|
-
cli.
|
|
238
|
+
async function run(args = helpers.hideBin(process__default$1.argv), scriptName = "meodp") {
|
|
239
|
+
await cli.scriptName(scriptName).parseAsync(args);
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
exports.__DEV__ = __DEV__;
|
package/dist/cli/index.d.cts
CHANGED
|
@@ -6,6 +6,6 @@ declare const __DEV__ = false;
|
|
|
6
6
|
*/
|
|
7
7
|
declare function debug(name: string, ...args: any[]): void;
|
|
8
8
|
declare const cli: yargs.Argv<{}>;
|
|
9
|
-
declare function run(): void
|
|
9
|
+
declare function run(args?: string[], scriptName?: string): Promise<void>;
|
|
10
10
|
|
|
11
11
|
export { __DEV__, cli, debug, run };
|
package/dist/cli/index.d.mts
CHANGED
|
@@ -6,6 +6,6 @@ declare const __DEV__ = false;
|
|
|
6
6
|
*/
|
|
7
7
|
declare function debug(name: string, ...args: any[]): void;
|
|
8
8
|
declare const cli: yargs.Argv<{}>;
|
|
9
|
-
declare function run(): void
|
|
9
|
+
declare function run(args?: string[], scriptName?: string): Promise<void>;
|
|
10
10
|
|
|
11
11
|
export { __DEV__, cli, debug, run };
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ declare const __DEV__ = false;
|
|
|
6
6
|
*/
|
|
7
7
|
declare function debug(name: string, ...args: any[]): void;
|
|
8
8
|
declare const cli: yargs.Argv<{}>;
|
|
9
|
-
declare function run(): void
|
|
9
|
+
declare function run(args?: string[], scriptName?: string): Promise<void>;
|
|
10
10
|
|
|
11
11
|
export { __DEV__, cli, debug, run };
|
package/dist/cli/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { colors } from 'consola/utils';
|
|
|
5
5
|
import yargs from 'yargs';
|
|
6
6
|
import { hideBin } from 'yargs/helpers';
|
|
7
7
|
import 'playwright';
|
|
8
|
-
import { j as createLowDB, h as defaultMEODPConfig, M as MEODP, r as runByConfig } from '../shared/meodp.
|
|
8
|
+
import { j as createLowDB, h as defaultMEODPConfig, M as MEODP, r as runByConfig } from '../shared/meodp.9a096f50.mjs';
|
|
9
9
|
import 'node:path';
|
|
10
10
|
import 'strip-ansi';
|
|
11
11
|
import 'winston';
|
|
@@ -57,13 +57,13 @@ function getErrorMdContent(sites) {
|
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
const statusInfo = link.statusText ? `${link.statusCode} ${link.statusText}` : link.statusCode;
|
|
60
|
-
md += ` - [${statusInfo}]
|
|
60
|
+
md += ` - [${statusInfo}] [${link.url}](${link.url})
|
|
61
61
|
`;
|
|
62
62
|
for (const req of link.requests) {
|
|
63
63
|
if (req.failed) {
|
|
64
64
|
if (req.statusCode) {
|
|
65
65
|
const statusInfo2 = req.statusText ? `${req.statusCode} ${req.statusText}` : req.statusCode;
|
|
66
|
-
md += ` - [${statusInfo2}]
|
|
66
|
+
md += ` - [${statusInfo2}] [${req.url}](${req.url})
|
|
67
67
|
`;
|
|
68
68
|
} else {
|
|
69
69
|
md += ` - [\u23F0 TIMEOUT] <${req.url}>
|
|
@@ -224,8 +224,8 @@ const cli = yargs(hideBin(process$1.argv)).scriptName("meodp").usage("$0 \u68C0\
|
|
|
224
224
|
await output(argv.type);
|
|
225
225
|
}
|
|
226
226
|
).alias("h", "help").alias("v", "version").showHelpOnFail(false).help();
|
|
227
|
-
function run() {
|
|
228
|
-
cli.
|
|
227
|
+
async function run(args = hideBin(process$1.argv), scriptName = "meodp") {
|
|
228
|
+
await cli.scriptName(scriptName).parseAsync(args);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
export { __DEV__, cli, debug, run };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const process = require('node:process');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
6
|
+
|
|
7
|
+
const process__default = /*#__PURE__*/_interopDefaultCompat(process);
|
|
8
|
+
|
|
9
|
+
const name = "meodp";
|
|
10
|
+
const type = "module";
|
|
11
|
+
const version = "0.1.0";
|
|
12
|
+
const description = "Check website and friend-link availability with sitemap discovery, history, and portable reports.";
|
|
13
|
+
const author = {
|
|
14
|
+
name: "YunYouJun",
|
|
15
|
+
url: "https://www.yunyoujun.cn"
|
|
16
|
+
};
|
|
17
|
+
const license = "MIT";
|
|
18
|
+
const homepage = "https://yunyoujun.github.io/meodp/";
|
|
19
|
+
const repository = {
|
|
20
|
+
type: "git",
|
|
21
|
+
url: "git+https://github.com/YunYouJun/meodp.git",
|
|
22
|
+
directory: "packages/meodp"
|
|
23
|
+
};
|
|
24
|
+
const bugs = {
|
|
25
|
+
url: "https://github.com/YunYouJun/meodp/issues"
|
|
26
|
+
};
|
|
27
|
+
const keywords = [
|
|
28
|
+
"meodp",
|
|
29
|
+
"link-checker",
|
|
30
|
+
"broken-links",
|
|
31
|
+
"sitemap",
|
|
32
|
+
"friend-links",
|
|
33
|
+
"cli"
|
|
34
|
+
];
|
|
35
|
+
const exports$1 = {
|
|
36
|
+
".": {
|
|
37
|
+
types: "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.mjs",
|
|
39
|
+
require: "./dist/index.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./check": {
|
|
42
|
+
"import": {
|
|
43
|
+
types: "./dist/check/index.d.mts",
|
|
44
|
+
"default": "./dist/check/index.mjs"
|
|
45
|
+
},
|
|
46
|
+
require: {
|
|
47
|
+
types: "./dist/check/index.d.cts",
|
|
48
|
+
"default": "./dist/check/index.cjs"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const main = "./dist/index.mjs";
|
|
53
|
+
const module$1 = "./dist/index.mjs";
|
|
54
|
+
const types = "./dist/index.d.ts";
|
|
55
|
+
const bin = {
|
|
56
|
+
meodp: "bin/index.mjs"
|
|
57
|
+
};
|
|
58
|
+
const files = [
|
|
59
|
+
"bin/index.mjs",
|
|
60
|
+
"dist"
|
|
61
|
+
];
|
|
62
|
+
const engines = {
|
|
63
|
+
node: ">=22.19.0"
|
|
64
|
+
};
|
|
65
|
+
const scripts = {
|
|
66
|
+
build: "tsx scripts/build-report-viewer.ts && unbuild",
|
|
67
|
+
dev: "tsx scripts/build-report-viewer.ts && unbuild --stub",
|
|
68
|
+
test: "tsx scripts/build-report-viewer.ts && tsx --test test/check.test.ts test/sitemap.test.ts",
|
|
69
|
+
"test:e2e": "tsx scripts/build-report-viewer.ts && playwright test",
|
|
70
|
+
typecheck: "tsx scripts/build-report-viewer.ts && tsc --noEmit -p tsconfig.json",
|
|
71
|
+
prepack: "npm run build",
|
|
72
|
+
release: "npm version --no-git-tag-version"
|
|
73
|
+
};
|
|
74
|
+
const peerDependencies = {
|
|
75
|
+
playwright: "^1",
|
|
76
|
+
typescript: "^5.0.0"
|
|
77
|
+
};
|
|
78
|
+
const peerDependenciesMeta = {
|
|
79
|
+
playwright: {
|
|
80
|
+
optional: true
|
|
81
|
+
},
|
|
82
|
+
typescript: {
|
|
83
|
+
optional: true
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const dependencies = {
|
|
87
|
+
c12: "^2.0.1",
|
|
88
|
+
"cli-progress": "^3.12.0",
|
|
89
|
+
consola: "^3.2.3",
|
|
90
|
+
"date-fns": "^4.1.0",
|
|
91
|
+
"fast-xml-parser": "^5.11.1",
|
|
92
|
+
"fs-extra": "^11.2.0",
|
|
93
|
+
"js-yaml": "^4.1.0",
|
|
94
|
+
linkinator: "^8.1.0",
|
|
95
|
+
lowdb: "^7.0.1",
|
|
96
|
+
"markdown-table": "^3.0.4",
|
|
97
|
+
"p-queue": "^8.0.1",
|
|
98
|
+
"strip-ansi": "^7.1.0",
|
|
99
|
+
winston: "^3.17.0",
|
|
100
|
+
yargs: "^17.7.2"
|
|
101
|
+
};
|
|
102
|
+
const devDependencies = {
|
|
103
|
+
"@playwright/test": "^1.48.2",
|
|
104
|
+
"@types/bun": "latest",
|
|
105
|
+
"@types/cli-progress": "^3.11.6",
|
|
106
|
+
"@types/fs-extra": "^11.0.4",
|
|
107
|
+
"@types/js-yaml": "^4.0.9",
|
|
108
|
+
"@types/node": "^22.9.0",
|
|
109
|
+
"@types/yargs": "^17.0.33",
|
|
110
|
+
cilicili: "^0.1.1",
|
|
111
|
+
esbuild: "^0.28.2",
|
|
112
|
+
playwright: "^1.48.2",
|
|
113
|
+
tsx: "^4.19.2",
|
|
114
|
+
unbuild: "^2.0.0",
|
|
115
|
+
"vite-node": "^2.1.4"
|
|
116
|
+
};
|
|
117
|
+
const publishConfig = {
|
|
118
|
+
access: "public",
|
|
119
|
+
registry: "https://registry.npmjs.org/"
|
|
120
|
+
};
|
|
121
|
+
const pkg = {
|
|
122
|
+
name: name,
|
|
123
|
+
type: type,
|
|
124
|
+
version: version,
|
|
125
|
+
description: description,
|
|
126
|
+
author: author,
|
|
127
|
+
license: license,
|
|
128
|
+
homepage: homepage,
|
|
129
|
+
repository: repository,
|
|
130
|
+
bugs: bugs,
|
|
131
|
+
keywords: keywords,
|
|
132
|
+
exports: exports$1,
|
|
133
|
+
main: main,
|
|
134
|
+
module: module$1,
|
|
135
|
+
types: types,
|
|
136
|
+
bin: bin,
|
|
137
|
+
files: files,
|
|
138
|
+
engines: engines,
|
|
139
|
+
scripts: scripts,
|
|
140
|
+
peerDependencies: peerDependencies,
|
|
141
|
+
peerDependenciesMeta: peerDependenciesMeta,
|
|
142
|
+
dependencies: dependencies,
|
|
143
|
+
devDependencies: devDependencies,
|
|
144
|
+
publishConfig: publishConfig
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const help = `Usage: meodp <command> [options]
|
|
148
|
+
|
|
149
|
+
Commands:
|
|
150
|
+
check <links.json|links.yml> Request listed HTTP(S) URLs and write fresh reports
|
|
151
|
+
sitemap <sitemap-url> Check pages listed in an XML sitemap or nested index
|
|
152
|
+
report [report.json] Export a static viewer from saved data; no site checks
|
|
153
|
+
scan [root] Run the legacy browser scanner using meodp.config.ts
|
|
154
|
+
export [root] Export a legacy browser-scan report
|
|
155
|
+
|
|
156
|
+
Options:
|
|
157
|
+
-h, --help Show this help
|
|
158
|
+
-v, --version Show the package version
|
|
159
|
+
|
|
160
|
+
Examples:
|
|
161
|
+
meodp check links.yml --output reports/links
|
|
162
|
+
meodp sitemap https://example.com/sitemap.xml --output reports/pages
|
|
163
|
+
meodp report reports/links/report.json --output reports/site
|
|
164
|
+
meodp check --help
|
|
165
|
+
meodp help report
|
|
166
|
+
|
|
167
|
+
check, sitemap, and scan initiate site checks. scan requires Playwright.
|
|
168
|
+
Running meodp without arguments shows help; no scan starts automatically.
|
|
169
|
+
`;
|
|
170
|
+
async function runCli(args = process__default.argv.slice(2)) {
|
|
171
|
+
try {
|
|
172
|
+
const [command, ...rest] = args;
|
|
173
|
+
if (!command || command === "--help" || command === "-h") {
|
|
174
|
+
if (rest.length)
|
|
175
|
+
throw new Error("Use meodp <command> --help for command-specific help");
|
|
176
|
+
console.log(help);
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
if (command === "--version" || command === "-v") {
|
|
180
|
+
if (rest.length)
|
|
181
|
+
throw new Error("--version does not accept additional arguments");
|
|
182
|
+
console.log(pkg.version);
|
|
183
|
+
return 0;
|
|
184
|
+
}
|
|
185
|
+
if (command === "help") {
|
|
186
|
+
if (!rest.length)
|
|
187
|
+
return runCli(["--help"]);
|
|
188
|
+
if (rest.length !== 1 || !["check", "sitemap", "report", "scan", "export"].includes(rest[0]))
|
|
189
|
+
throw new Error("Use meodp help <check|sitemap|report|scan|export>");
|
|
190
|
+
return runCli([rest[0], "--help"]);
|
|
191
|
+
}
|
|
192
|
+
if (command === "check") {
|
|
193
|
+
const { runCheckCli } = await import('../check/cli.cjs');
|
|
194
|
+
return runCheckCli(rest);
|
|
195
|
+
}
|
|
196
|
+
if (command === "report") {
|
|
197
|
+
const { runReportCli } = await import('../check/cli.cjs');
|
|
198
|
+
return runReportCli(rest);
|
|
199
|
+
}
|
|
200
|
+
if (command === "sitemap") {
|
|
201
|
+
const { runSitemapCli } = await import('../check/cli.cjs');
|
|
202
|
+
return runSitemapCli(rest);
|
|
203
|
+
}
|
|
204
|
+
if (command === "scan" || command === "export") {
|
|
205
|
+
if (rest.includes("--help") || rest.includes("-h")) {
|
|
206
|
+
console.log(command === "scan" ? "Usage: meodp scan [root]\n\nRun the legacy Playwright scanner with meodp.config.ts in root (default: .).\nThis starts browser/network activity and uses the legacy configuration and reports." : "Usage: meodp export [root] [--type md|html]\n\nExport the legacy browser scanner's stored data.\nFor a schemaVersion: 1 report.json, use meodp report instead.");
|
|
207
|
+
return 0;
|
|
208
|
+
}
|
|
209
|
+
const { run } = await import('./index.cjs');
|
|
210
|
+
await run(command === "scan" ? rest : ["export", ...rest], command === "scan" ? "meodp scan" : "meodp");
|
|
211
|
+
return 0;
|
|
212
|
+
}
|
|
213
|
+
throw new Error(`Unknown command ${JSON.stringify(command)}. Use meodp --help. For the legacy scanner, use meodp scan [root].`);
|
|
214
|
+
} catch (error) {
|
|
215
|
+
console.error(`meodp: ${error instanceof Error ? error.message : String(error)}`);
|
|
216
|
+
return 2;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
exports.runCli = runCli;
|