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.
@@ -0,0 +1,214 @@
1
+ import process from 'node:process';
2
+
3
+ const name = "meodp";
4
+ const type = "module";
5
+ const version = "0.1.0";
6
+ const description = "Check website and friend-link availability with sitemap discovery, history, and portable reports.";
7
+ const author = {
8
+ name: "YunYouJun",
9
+ url: "https://www.yunyoujun.cn"
10
+ };
11
+ const license = "MIT";
12
+ const homepage = "https://yunyoujun.github.io/meodp/";
13
+ const repository = {
14
+ type: "git",
15
+ url: "git+https://github.com/YunYouJun/meodp.git",
16
+ directory: "packages/meodp"
17
+ };
18
+ const bugs = {
19
+ url: "https://github.com/YunYouJun/meodp/issues"
20
+ };
21
+ const keywords = [
22
+ "meodp",
23
+ "link-checker",
24
+ "broken-links",
25
+ "sitemap",
26
+ "friend-links",
27
+ "cli"
28
+ ];
29
+ const exports = {
30
+ ".": {
31
+ types: "./dist/index.d.ts",
32
+ "import": "./dist/index.mjs",
33
+ require: "./dist/index.cjs"
34
+ },
35
+ "./check": {
36
+ "import": {
37
+ types: "./dist/check/index.d.mts",
38
+ "default": "./dist/check/index.mjs"
39
+ },
40
+ require: {
41
+ types: "./dist/check/index.d.cts",
42
+ "default": "./dist/check/index.cjs"
43
+ }
44
+ }
45
+ };
46
+ const main = "./dist/index.mjs";
47
+ const module = "./dist/index.mjs";
48
+ const types = "./dist/index.d.ts";
49
+ const bin = {
50
+ meodp: "bin/index.mjs"
51
+ };
52
+ const files = [
53
+ "bin/index.mjs",
54
+ "dist"
55
+ ];
56
+ const engines = {
57
+ node: ">=22.19.0"
58
+ };
59
+ const scripts = {
60
+ build: "tsx scripts/build-report-viewer.ts && unbuild",
61
+ dev: "tsx scripts/build-report-viewer.ts && unbuild --stub",
62
+ test: "tsx scripts/build-report-viewer.ts && tsx --test test/check.test.ts test/sitemap.test.ts",
63
+ "test:e2e": "tsx scripts/build-report-viewer.ts && playwright test",
64
+ typecheck: "tsx scripts/build-report-viewer.ts && tsc --noEmit -p tsconfig.json",
65
+ prepack: "npm run build",
66
+ release: "npm version --no-git-tag-version"
67
+ };
68
+ const peerDependencies = {
69
+ playwright: "^1",
70
+ typescript: "^5.0.0"
71
+ };
72
+ const peerDependenciesMeta = {
73
+ playwright: {
74
+ optional: true
75
+ },
76
+ typescript: {
77
+ optional: true
78
+ }
79
+ };
80
+ const dependencies = {
81
+ c12: "^2.0.1",
82
+ "cli-progress": "^3.12.0",
83
+ consola: "^3.2.3",
84
+ "date-fns": "^4.1.0",
85
+ "fast-xml-parser": "^5.11.1",
86
+ "fs-extra": "^11.2.0",
87
+ "js-yaml": "^4.1.0",
88
+ linkinator: "^8.1.0",
89
+ lowdb: "^7.0.1",
90
+ "markdown-table": "^3.0.4",
91
+ "p-queue": "^8.0.1",
92
+ "strip-ansi": "^7.1.0",
93
+ winston: "^3.17.0",
94
+ yargs: "^17.7.2"
95
+ };
96
+ const devDependencies = {
97
+ "@playwright/test": "^1.48.2",
98
+ "@types/bun": "latest",
99
+ "@types/cli-progress": "^3.11.6",
100
+ "@types/fs-extra": "^11.0.4",
101
+ "@types/js-yaml": "^4.0.9",
102
+ "@types/node": "^22.9.0",
103
+ "@types/yargs": "^17.0.33",
104
+ cilicili: "^0.1.1",
105
+ esbuild: "^0.28.2",
106
+ playwright: "^1.48.2",
107
+ tsx: "^4.19.2",
108
+ unbuild: "^2.0.0",
109
+ "vite-node": "^2.1.4"
110
+ };
111
+ const publishConfig = {
112
+ access: "public",
113
+ registry: "https://registry.npmjs.org/"
114
+ };
115
+ const pkg = {
116
+ name: name,
117
+ type: type,
118
+ version: version,
119
+ description: description,
120
+ author: author,
121
+ license: license,
122
+ homepage: homepage,
123
+ repository: repository,
124
+ bugs: bugs,
125
+ keywords: keywords,
126
+ exports: exports,
127
+ main: main,
128
+ module: module,
129
+ types: types,
130
+ bin: bin,
131
+ files: files,
132
+ engines: engines,
133
+ scripts: scripts,
134
+ peerDependencies: peerDependencies,
135
+ peerDependenciesMeta: peerDependenciesMeta,
136
+ dependencies: dependencies,
137
+ devDependencies: devDependencies,
138
+ publishConfig: publishConfig
139
+ };
140
+
141
+ const help = `Usage: meodp <command> [options]
142
+
143
+ Commands:
144
+ check <links.json|links.yml> Request listed HTTP(S) URLs and write fresh reports
145
+ sitemap <sitemap-url> Check pages listed in an XML sitemap or nested index
146
+ report [report.json] Export a static viewer from saved data; no site checks
147
+ scan [root] Run the legacy browser scanner using meodp.config.ts
148
+ export [root] Export a legacy browser-scan report
149
+
150
+ Options:
151
+ -h, --help Show this help
152
+ -v, --version Show the package version
153
+
154
+ Examples:
155
+ meodp check links.yml --output reports/links
156
+ meodp sitemap https://example.com/sitemap.xml --output reports/pages
157
+ meodp report reports/links/report.json --output reports/site
158
+ meodp check --help
159
+ meodp help report
160
+
161
+ check, sitemap, and scan initiate site checks. scan requires Playwright.
162
+ Running meodp without arguments shows help; no scan starts automatically.
163
+ `;
164
+ async function runCli(args = process.argv.slice(2)) {
165
+ try {
166
+ const [command, ...rest] = args;
167
+ if (!command || command === "--help" || command === "-h") {
168
+ if (rest.length)
169
+ throw new Error("Use meodp <command> --help for command-specific help");
170
+ console.log(help);
171
+ return 0;
172
+ }
173
+ if (command === "--version" || command === "-v") {
174
+ if (rest.length)
175
+ throw new Error("--version does not accept additional arguments");
176
+ console.log(pkg.version);
177
+ return 0;
178
+ }
179
+ if (command === "help") {
180
+ if (!rest.length)
181
+ return runCli(["--help"]);
182
+ if (rest.length !== 1 || !["check", "sitemap", "report", "scan", "export"].includes(rest[0]))
183
+ throw new Error("Use meodp help <check|sitemap|report|scan|export>");
184
+ return runCli([rest[0], "--help"]);
185
+ }
186
+ if (command === "check") {
187
+ const { runCheckCli } = await import('../check/cli.mjs');
188
+ return runCheckCli(rest);
189
+ }
190
+ if (command === "report") {
191
+ const { runReportCli } = await import('../check/cli.mjs');
192
+ return runReportCli(rest);
193
+ }
194
+ if (command === "sitemap") {
195
+ const { runSitemapCli } = await import('../check/cli.mjs');
196
+ return runSitemapCli(rest);
197
+ }
198
+ if (command === "scan" || command === "export") {
199
+ if (rest.includes("--help") || rest.includes("-h")) {
200
+ 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.");
201
+ return 0;
202
+ }
203
+ const { run } = await import('./index.mjs');
204
+ await run(command === "scan" ? rest : ["export", ...rest], command === "scan" ? "meodp scan" : "meodp");
205
+ return 0;
206
+ }
207
+ throw new Error(`Unknown command ${JSON.stringify(command)}. Use meodp --help. For the legacy scanner, use meodp scan [root].`);
208
+ } catch (error) {
209
+ console.error(`meodp: ${error instanceof Error ? error.message : String(error)}`);
210
+ return 2;
211
+ }
212
+ }
213
+
214
+ export { runCli };
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./shared/meodp.6b19529e.cjs');
3
+ const index = require('./shared/meodp.15f2977d.cjs');
4
4
  require('consola/utils');
5
5
  require('playwright');
6
6
  require('node:path');
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { g as getBrowser, s as siteUrlMap } from './shared/meodp.b58178b8.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.b58178b8.mjs';
1
+ import { g as getBrowser, s as siteUrlMap } from './shared/meodp.9a096f50.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.9a096f50.mjs';
3
3
  import 'consola/utils';
4
4
  import 'playwright';
5
5
  import 'node:path';
@@ -775,7 +775,7 @@ async function checkSiteUrl(url, options) {
775
775
  failed: value.failed,
776
776
  ignored: value.ignored,
777
777
  // res.url 还没用返回
778
- url: req?.url(),
778
+ url: value.request.url(),
779
779
  statusCode: res2?.status(),
780
780
  statusText: res2?.statusText()
781
781
  };
@@ -759,7 +759,7 @@ async function checkSiteUrl(url, options) {
759
759
  failed: value.failed,
760
760
  ignored: value.ignored,
761
761
  // res.url 还没用返回
762
- url: req?.url(),
762
+ url: value.request.url(),
763
763
  statusCode: res2?.status(),
764
764
  statusText: res2?.statusText()
765
765
  };