meodp 0.0.7 → 0.0.9

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.
@@ -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.9bf8b8ff.cjs');
10
+ const index = require('../shared/meodp.15f2977d.cjs');
11
11
  require('node:path');
12
12
  require('strip-ansi');
13
13
  require('winston');
@@ -63,6 +63,26 @@ function getErrorMdContent(sites) {
63
63
  for (const [key, value] of errorSites) {
64
64
  md += `- [${value.name || value.url}](${value.url})
65
65
  `;
66
+ for (const link of value.links) {
67
+ if (link.checkStatus === "passed") {
68
+ continue;
69
+ }
70
+ const statusInfo = link.statusText ? `${link.statusCode} ${link.statusText}` : link.statusCode;
71
+ md += ` - [${statusInfo}] [${link.url}](${link.url})
72
+ `;
73
+ for (const req of link.requests) {
74
+ if (req.failed) {
75
+ if (req.statusCode) {
76
+ const statusInfo2 = req.statusText ? `${req.statusCode} ${req.statusText}` : req.statusCode;
77
+ md += ` - [${statusInfo2}] [${req.url}](${req.url})
78
+ `;
79
+ } else {
80
+ md += ` - [\u23F0 TIMEOUT] <${req.url}>
81
+ `;
82
+ }
83
+ }
84
+ }
85
+ }
66
86
  }
67
87
  return md;
68
88
  }
@@ -120,7 +140,7 @@ async function outputMarkdown(options = {
120
140
  const db = await index.createLowDB();
121
141
  await db.read();
122
142
  const rootDir = process__default.cwd();
123
- const mdPath = path__default.resolve(rootDir, "logs/meodp/result.md");
143
+ const mdPath = path__default.resolve(rootDir, "logs/meodp/report.md");
124
144
  await fs__default.ensureFile(mdPath);
125
145
  let mdContent = "# MEODP Report\n";
126
146
  if (options.showConfig) {
@@ -140,7 +160,7 @@ ${JSON.stringify(db.data.config, null, 2)}
140
160
 
141
161
  ${getErrorMdContent(db.data.sites)}
142
162
  `;
143
- mdContent += "\n## Sites\n";
163
+ mdContent += "## Sites\n";
144
164
  for (const [key, value] of Object.entries(db.data.sites)) {
145
165
  const site = value;
146
166
  mdContent += `
@@ -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.5489574b.mjs';
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';
@@ -52,6 +52,26 @@ function getErrorMdContent(sites) {
52
52
  for (const [key, value] of errorSites) {
53
53
  md += `- [${value.name || value.url}](${value.url})
54
54
  `;
55
+ for (const link of value.links) {
56
+ if (link.checkStatus === "passed") {
57
+ continue;
58
+ }
59
+ const statusInfo = link.statusText ? `${link.statusCode} ${link.statusText}` : link.statusCode;
60
+ md += ` - [${statusInfo}] [${link.url}](${link.url})
61
+ `;
62
+ for (const req of link.requests) {
63
+ if (req.failed) {
64
+ if (req.statusCode) {
65
+ const statusInfo2 = req.statusText ? `${req.statusCode} ${req.statusText}` : req.statusCode;
66
+ md += ` - [${statusInfo2}] [${req.url}](${req.url})
67
+ `;
68
+ } else {
69
+ md += ` - [\u23F0 TIMEOUT] <${req.url}>
70
+ `;
71
+ }
72
+ }
73
+ }
74
+ }
55
75
  }
56
76
  return md;
57
77
  }
@@ -109,7 +129,7 @@ async function outputMarkdown(options = {
109
129
  const db = await createLowDB();
110
130
  await db.read();
111
131
  const rootDir = process.cwd();
112
- const mdPath = path.resolve(rootDir, "logs/meodp/result.md");
132
+ const mdPath = path.resolve(rootDir, "logs/meodp/report.md");
113
133
  await fs.ensureFile(mdPath);
114
134
  let mdContent = "# MEODP Report\n";
115
135
  if (options.showConfig) {
@@ -129,7 +149,7 @@ ${JSON.stringify(db.data.config, null, 2)}
129
149
 
130
150
  ${getErrorMdContent(db.data.sites)}
131
151
  `;
132
- mdContent += "\n## Sites\n";
152
+ mdContent += "## Sites\n";
133
153
  for (const [key, value] of Object.entries(db.data.sites)) {
134
154
  const site = value;
135
155
  mdContent += `
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./shared/meodp.9bf8b8ff.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.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';
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';
@@ -709,7 +709,11 @@ async function checkSiteUrl(url, options) {
709
709
  });
710
710
  } catch (e) {
711
711
  siteLinkItem.timeout = 1;
712
- MEODP.logger.error(e);
712
+ MEODP.logger.inner(
713
+ utils.colors.red("[Timeout]"),
714
+ utils.colors.underline(url)
715
+ );
716
+ consola__default.debug(e);
713
717
  }
714
718
  if (!res)
715
719
  return;
@@ -770,7 +774,8 @@ async function checkSiteUrl(url, options) {
770
774
  return {
771
775
  failed: value.failed,
772
776
  ignored: value.ignored,
773
- url: res2?.url(),
777
+ // res.url 还没用返回
778
+ url: value.request.url(),
774
779
  statusCode: res2?.status(),
775
780
  statusText: res2?.statusText()
776
781
  };
@@ -693,7 +693,11 @@ async function checkSiteUrl(url, options) {
693
693
  });
694
694
  } catch (e) {
695
695
  siteLinkItem.timeout = 1;
696
- MEODP.logger.error(e);
696
+ MEODP.logger.inner(
697
+ colors.red("[Timeout]"),
698
+ colors.underline(url)
699
+ );
700
+ consola.debug(e);
697
701
  }
698
702
  if (!res)
699
703
  return;
@@ -754,7 +758,8 @@ async function checkSiteUrl(url, options) {
754
758
  return {
755
759
  failed: value.failed,
756
760
  ignored: value.ignored,
757
- url: res2?.url(),
761
+ // res.url 还没用返回
762
+ url: value.request.url(),
758
763
  statusCode: res2?.status(),
759
764
  statusText: res2?.statusText()
760
765
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "meodp",
3
3
  "type": "module",
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "packageManager": "pnpm@9.12.3",
6
6
  "description": "Mystic Eyes of Death Perception. Find out dead links in your site.",
7
7
  "keywords": [