meodp 0.0.1
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/LICENSE +21 -0
- package/README.md +41 -0
- package/bin/index.ts +6 -0
- package/dist/cli/index.cjs +76 -0
- package/dist/cli/index.d.cts +11 -0
- package/dist/cli/index.d.mts +11 -0
- package/dist/cli/index.d.ts +11 -0
- package/dist/cli/index.mjs +65 -0
- package/dist/index.cjs +72 -0
- package/dist/index.d.cts +360 -0
- package/dist/index.d.mts +360 -0
- package/dist/index.d.ts +360 -0
- package/dist/index.mjs +45 -0
- package/dist/shared/meodp.6ae77875.cjs +862 -0
- package/dist/shared/meodp.faa3c78c.mjs +819 -0
- package/package.json +82 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { g as getBrowser, s as siteUrlMap } from './shared/meodp.faa3c78c.mjs';
|
|
2
|
+
export { L as LocalLog, P as PQueueMap, a as checkLink, c as checkMEODPUrl, f as checkSite, e as checkSiteUrl, d as checkUrlNomoduleAssets, k as createMEODPLogger, m as createWinstonLogger, h as defaultMEODPConfig, i as defineConfig, w as emojiMap, q as formatArgs, t as getFormattedDataFromResponse, x as getMEODPUrlItemInfo, b as getSiteLinks, u as isLink, j as localLog, l as logUrlItemInfo, n as multiBar, v as parseUrlMap, p as progressBarMap, o as registerPageEvents, r as runByConfig } from './shared/meodp.faa3c78c.mjs';
|
|
3
|
+
import 'consola';
|
|
4
|
+
import 'p-queue';
|
|
5
|
+
import 'consola/utils';
|
|
6
|
+
import 'playwright';
|
|
7
|
+
import 'node:path';
|
|
8
|
+
import 'node:process';
|
|
9
|
+
import 'date-fns';
|
|
10
|
+
import 'fs-extra';
|
|
11
|
+
import 'strip-ansi';
|
|
12
|
+
import 'winston';
|
|
13
|
+
import 'winston/lib/winston/transports';
|
|
14
|
+
import 'cli-progress';
|
|
15
|
+
import 'cli-progress/lib/options';
|
|
16
|
+
import 'cli-progress/lib/format-bar';
|
|
17
|
+
import 'cli-progress/lib/format-time';
|
|
18
|
+
|
|
19
|
+
async function checkSiteMap(urlItem) {
|
|
20
|
+
const { url } = urlItem;
|
|
21
|
+
const robotsUrl = new URL("/robots.txt", url).href;
|
|
22
|
+
const browser = await getBrowser();
|
|
23
|
+
const page = await browser.newPage();
|
|
24
|
+
await page.goto(robotsUrl);
|
|
25
|
+
const text = await page.textContent("pre");
|
|
26
|
+
const sitemap = text?.match(/Sitemap: (.*)/)?.[1];
|
|
27
|
+
let sitemapUrl = new URL(sitemap || "/sitemap.xml", url).href;
|
|
28
|
+
if (sitemap) {
|
|
29
|
+
sitemapUrl = sitemap.startsWith("http") ? sitemap : new URL(sitemap, url).href;
|
|
30
|
+
}
|
|
31
|
+
await page.goto(sitemapUrl);
|
|
32
|
+
const links = await page.$$eval("loc", (elements) => {
|
|
33
|
+
return elements.map((element) => element.textContent);
|
|
34
|
+
});
|
|
35
|
+
for (const link of links) {
|
|
36
|
+
if (link && !siteUrlMap.has(link)) {
|
|
37
|
+
siteUrlMap.set(link, {
|
|
38
|
+
statusCode: 0,
|
|
39
|
+
checkStatus: "pending"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { checkSiteMap, getBrowser, siteUrlMap };
|