@memvid/maw 1.0.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 +188 -0
- package/dist/bin/maw.d.ts +6 -0
- package/dist/bin/maw.d.ts.map +1 -0
- package/dist/bin/maw.js +275 -0
- package/dist/bin/maw.js.map +1 -0
- package/dist/src/crawler/index.d.ts +71 -0
- package/dist/src/crawler/index.d.ts.map +1 -0
- package/dist/src/crawler/index.js +249 -0
- package/dist/src/crawler/index.js.map +1 -0
- package/dist/src/crawler/robots.d.ts +26 -0
- package/dist/src/crawler/robots.d.ts.map +1 -0
- package/dist/src/crawler/robots.js +179 -0
- package/dist/src/crawler/robots.js.map +1 -0
- package/dist/src/crawler/sitemap.d.ts +36 -0
- package/dist/src/crawler/sitemap.d.ts.map +1 -0
- package/dist/src/crawler/sitemap.js +209 -0
- package/dist/src/crawler/sitemap.js.map +1 -0
- package/dist/src/engine/detector.d.ts +18 -0
- package/dist/src/engine/detector.d.ts.map +1 -0
- package/dist/src/engine/detector.js +155 -0
- package/dist/src/engine/detector.js.map +1 -0
- package/dist/src/engine/fetch.d.ts +18 -0
- package/dist/src/engine/fetch.d.ts.map +1 -0
- package/dist/src/engine/fetch.js +53 -0
- package/dist/src/engine/fetch.js.map +1 -0
- package/dist/src/engine/index.d.ts +39 -0
- package/dist/src/engine/index.d.ts.map +1 -0
- package/dist/src/engine/index.js +116 -0
- package/dist/src/engine/index.js.map +1 -0
- package/dist/src/engine/playwright.d.ts +23 -0
- package/dist/src/engine/playwright.d.ts.map +1 -0
- package/dist/src/engine/playwright.js +88 -0
- package/dist/src/engine/playwright.js.map +1 -0
- package/dist/src/engine/rebrowser.d.ts +22 -0
- package/dist/src/engine/rebrowser.d.ts.map +1 -0
- package/dist/src/engine/rebrowser.js +142 -0
- package/dist/src/engine/rebrowser.js.map +1 -0
- package/dist/src/extractor/cleaner.d.ts +13 -0
- package/dist/src/extractor/cleaner.d.ts.map +1 -0
- package/dist/src/extractor/cleaner.js +122 -0
- package/dist/src/extractor/cleaner.js.map +1 -0
- package/dist/src/extractor/index.d.ts +29 -0
- package/dist/src/extractor/index.d.ts.map +1 -0
- package/dist/src/extractor/index.js +162 -0
- package/dist/src/extractor/index.js.map +1 -0
- package/dist/src/extractor/links.d.ts +22 -0
- package/dist/src/extractor/links.d.ts.map +1 -0
- package/dist/src/extractor/links.js +92 -0
- package/dist/src/extractor/links.js.map +1 -0
- package/dist/src/extractor/markdown.d.ts +13 -0
- package/dist/src/extractor/markdown.d.ts.map +1 -0
- package/dist/src/extractor/markdown.js +94 -0
- package/dist/src/extractor/markdown.js.map +1 -0
- package/dist/src/git/index.d.ts +40 -0
- package/dist/src/git/index.d.ts.map +1 -0
- package/dist/src/git/index.js +303 -0
- package/dist/src/git/index.js.map +1 -0
- package/dist/src/index.d.ts +103 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +229 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ingestor/index.d.ts +95 -0
- package/dist/src/ingestor/index.d.ts.map +1 -0
- package/dist/src/ingestor/index.js +471 -0
- package/dist/src/ingestor/index.js.map +1 -0
- package/dist/src/utils/dedup.d.ts +66 -0
- package/dist/src/utils/dedup.d.ts.map +1 -0
- package/dist/src/utils/dedup.js +296 -0
- package/dist/src/utils/dedup.js.map +1 -0
- package/dist/src/utils/index.d.ts +3 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +3 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/logger.d.ts +12 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +49 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/ui.d.ts +126 -0
- package/dist/src/utils/ui.d.ts.map +1 -0
- package/dist/src/utils/ui.js +357 -0
- package/dist/src/utils/ui.js.map +1 -0
- package/dist/src/utils/url.d.ts +21 -0
- package/dist/src/utils/url.d.ts.map +1 -0
- package/dist/src/utils/url.js +107 -0
- package/dist/src/utils/url.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart duplicate detection for web crawling
|
|
3
|
+
* - Detects localized URLs (e.g., /en-us/, /de-de/, /fr-fr/)
|
|
4
|
+
* - Content similarity fingerprinting
|
|
5
|
+
* - URL path normalization
|
|
6
|
+
*/
|
|
7
|
+
// Common locale patterns in URLs
|
|
8
|
+
const LOCALE_PATTERNS = [
|
|
9
|
+
// ISO codes: en-us, de-de, fr-fr, pt-br, zh-cn
|
|
10
|
+
/\/([a-z]{2}-[a-z]{2})\//i,
|
|
11
|
+
// Short codes: /en/, /de/, /fr/
|
|
12
|
+
/\/([a-z]{2})\/(?=[a-z])/i,
|
|
13
|
+
// Subdomain: en.example.com, de.example.com
|
|
14
|
+
/^https?:\/\/([a-z]{2})\./i,
|
|
15
|
+
// Query param: ?lang=en, ?locale=de-DE
|
|
16
|
+
/[?&](lang|locale|hl|language)=([a-z]{2}(-[a-z]{2})?)/i,
|
|
17
|
+
];
|
|
18
|
+
// Known language codes (ISO 639-1)
|
|
19
|
+
const LANGUAGE_CODES = new Set([
|
|
20
|
+
// Major world languages
|
|
21
|
+
'en', 'de', 'fr', 'es', 'it', 'pt', 'nl', 'pl', 'ru', 'ja', 'ko', 'zh',
|
|
22
|
+
'ar', 'hi', 'tr', 'vi', 'th', 'id', 'ms', 'sv', 'no', 'da', 'fi', 'cs',
|
|
23
|
+
'el', 'he', 'hu', 'ro', 'sk', 'uk', 'bg', 'hr', 'lt', 'lv', 'et', 'sl',
|
|
24
|
+
// Indian languages
|
|
25
|
+
'bn', 'ta', 'te', 'mr', 'gu', 'kn', 'ml', 'pa', 'ur',
|
|
26
|
+
// Asian languages
|
|
27
|
+
'km', 'lo', 'ne', 'si', 'tl', 'mn', 'fa', 'ps',
|
|
28
|
+
// European languages
|
|
29
|
+
'sq', 'mk', 'sr', 'bs', 'is', 'mt', 'cy', 'ga', 'eu', 'gl',
|
|
30
|
+
// African languages
|
|
31
|
+
'sw', 'am', 'af', 'ha', 'yo', 'ig', 'zu',
|
|
32
|
+
// Central Asian
|
|
33
|
+
'az', 'uz', 'kk', 'ka', 'hy', 'tg',
|
|
34
|
+
]);
|
|
35
|
+
// Known country codes (ISO 3166-1 alpha-2)
|
|
36
|
+
const COUNTRY_CODES = new Set([
|
|
37
|
+
// North America & Europe
|
|
38
|
+
'us', 'gb', 'uk', 'ca', 'au', 'nz', 'ie', 'de', 'at', 'ch', 'fr', 'be',
|
|
39
|
+
'es', 'it', 'pt', 'nl', 'pl', 'ru', 'se', 'no', 'dk', 'fi', 'cz', 'gr',
|
|
40
|
+
'hu', 'ro', 'sk', 'ua', 'bg', 'hr', 'rs', 'si', 'lt', 'lv', 'ee',
|
|
41
|
+
// Asia Pacific
|
|
42
|
+
'jp', 'kr', 'cn', 'tw', 'hk', 'sg', 'my', 'th', 'vn', 'ph', 'mm', 'kh',
|
|
43
|
+
'la', 'np', 'lk', 'bd', 'pk',
|
|
44
|
+
// Middle East & North Africa
|
|
45
|
+
'in', 'ae', 'sa', 'il', 'eg', 'ma', 'dz', 'tn', 'lb', 'jo', 'kw', 'qa',
|
|
46
|
+
'bh', 'om', 'iq', 'ir', 'tr',
|
|
47
|
+
// Africa
|
|
48
|
+
'za', 'ng', 'ke', 'gh', 'tz', 'ug', 'et', 'sn', 'ci',
|
|
49
|
+
// Latin America
|
|
50
|
+
'mx', 'ar', 'br', 'co', 'cl', 'pe', 'ec', 've', 'bo', 'py', 'uy',
|
|
51
|
+
'cr', 'pa', 'gt', 'hn', 'ni', 'cu', 'do', 'pr', 'jm',
|
|
52
|
+
]);
|
|
53
|
+
/**
|
|
54
|
+
* Extract locale information from a URL
|
|
55
|
+
*/
|
|
56
|
+
export function extractLocale(url) {
|
|
57
|
+
try {
|
|
58
|
+
const parsed = new URL(url);
|
|
59
|
+
let path = parsed.pathname;
|
|
60
|
+
let locale;
|
|
61
|
+
let language;
|
|
62
|
+
let country;
|
|
63
|
+
// Check for locale in path (most common patterns)
|
|
64
|
+
// Match: /en-us/, /de-de/, /fr/, /jp/, /zh-cn/, /mx/, /br/, etc.
|
|
65
|
+
// Also match: /en_US/, /de_DE/ (underscore variant)
|
|
66
|
+
const pathMatch = path.match(/^\/([a-z]{2})([-_]([a-z]{2}))?(?=\/|$)/i);
|
|
67
|
+
if (pathMatch) {
|
|
68
|
+
const first = pathMatch[1].toLowerCase();
|
|
69
|
+
const second = pathMatch[3]?.toLowerCase();
|
|
70
|
+
// Check if first segment is a language OR country code (Stripe uses /jp/, /mx/, /br/)
|
|
71
|
+
const isLanguage = LANGUAGE_CODES.has(first);
|
|
72
|
+
const isCountry = COUNTRY_CODES.has(first);
|
|
73
|
+
if (isLanguage || isCountry) {
|
|
74
|
+
if (isLanguage) {
|
|
75
|
+
language = first;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
country = first;
|
|
79
|
+
}
|
|
80
|
+
if (second && COUNTRY_CODES.has(second)) {
|
|
81
|
+
country = second;
|
|
82
|
+
locale = `${first}-${second}`;
|
|
83
|
+
}
|
|
84
|
+
else if (second && LANGUAGE_CODES.has(second)) {
|
|
85
|
+
// Some sites use /de-de/ where second part is also a language code
|
|
86
|
+
country = second;
|
|
87
|
+
locale = `${first}-${second}`;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
locale = first;
|
|
91
|
+
}
|
|
92
|
+
// Remove locale from path for canonical
|
|
93
|
+
path = path.replace(/^\/[a-z]{2}([-_][a-z]{2})?/i, '') || '/';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Also check for locale anywhere in path (not just at start)
|
|
97
|
+
// Pattern: /site/jp/pricing, /docs/es/guide
|
|
98
|
+
if (!locale) {
|
|
99
|
+
const midPathMatch = path.match(/\/([a-z]{2})([-_]([a-z]{2}))?(?=\/)/i);
|
|
100
|
+
if (midPathMatch) {
|
|
101
|
+
const first = midPathMatch[1].toLowerCase();
|
|
102
|
+
const second = midPathMatch[3]?.toLowerCase();
|
|
103
|
+
// Treat as locale if it's a known language OR country code
|
|
104
|
+
// Exclude common false positives that are English words
|
|
105
|
+
const isLanguage = LANGUAGE_CODES.has(first);
|
|
106
|
+
const isCountry = COUNTRY_CODES.has(first);
|
|
107
|
+
const isFalsePositive = [
|
|
108
|
+
'us', 'uk', 'my', 'in', 'at', 'be', 'to', 'do', 'go', 'so', 'no', 'id', // original
|
|
109
|
+
'am', 'is', 'it', 'me', 'or', 'as', 'if', 'an', 'on', 'up', // common English words
|
|
110
|
+
'la', 'ha', 'pa', 'om', // filler/informal
|
|
111
|
+
].includes(first);
|
|
112
|
+
if ((isLanguage || isCountry) && !isFalsePositive) {
|
|
113
|
+
if (isLanguage) {
|
|
114
|
+
language = first;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
country = first;
|
|
118
|
+
}
|
|
119
|
+
if (second && COUNTRY_CODES.has(second)) {
|
|
120
|
+
country = second;
|
|
121
|
+
locale = `${first}-${second}`;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
locale = first;
|
|
125
|
+
}
|
|
126
|
+
// Remove locale segment from path
|
|
127
|
+
path = path.replace(/\/[a-z]{2}([-_][a-z]{2})?(?=\/)/i, '');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Check query params for locale
|
|
132
|
+
const langParam = parsed.searchParams.get('lang') ||
|
|
133
|
+
parsed.searchParams.get('locale') ||
|
|
134
|
+
parsed.searchParams.get('hl') ||
|
|
135
|
+
parsed.searchParams.get('language');
|
|
136
|
+
if (langParam && !locale) {
|
|
137
|
+
const parts = langParam.toLowerCase().split(/[-_]/);
|
|
138
|
+
if (LANGUAGE_CODES.has(parts[0])) {
|
|
139
|
+
language = parts[0];
|
|
140
|
+
if (parts[1] && COUNTRY_CODES.has(parts[1])) {
|
|
141
|
+
country = parts[1];
|
|
142
|
+
locale = `${parts[0]}-${parts[1]}`;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
locale = parts[0];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Remove locale-related query params for canonical path
|
|
150
|
+
parsed.searchParams.delete('lang');
|
|
151
|
+
parsed.searchParams.delete('locale');
|
|
152
|
+
parsed.searchParams.delete('hl');
|
|
153
|
+
parsed.searchParams.delete('language');
|
|
154
|
+
const queryString = parsed.searchParams.toString();
|
|
155
|
+
const canonicalPath = path + (queryString ? `?${queryString}` : '');
|
|
156
|
+
return {
|
|
157
|
+
hasLocale: !!locale,
|
|
158
|
+
locale,
|
|
159
|
+
language,
|
|
160
|
+
country,
|
|
161
|
+
canonicalPath,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return {
|
|
166
|
+
hasLocale: false,
|
|
167
|
+
canonicalPath: url,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Generate a content fingerprint for similarity detection
|
|
173
|
+
* Uses multiple techniques for robust matching
|
|
174
|
+
*/
|
|
175
|
+
export function generateFingerprint(text) {
|
|
176
|
+
// Normalize text
|
|
177
|
+
const normalized = text
|
|
178
|
+
.toLowerCase()
|
|
179
|
+
.replace(/\s+/g, ' ')
|
|
180
|
+
.replace(/[^\w\s]/g, '')
|
|
181
|
+
.trim();
|
|
182
|
+
// Take key portions: start, middle, end
|
|
183
|
+
const len = normalized.length;
|
|
184
|
+
if (len < 500) {
|
|
185
|
+
return normalized;
|
|
186
|
+
}
|
|
187
|
+
// Sample from different parts of the document
|
|
188
|
+
const start = normalized.slice(0, 300);
|
|
189
|
+
const middle = normalized.slice(Math.floor(len / 2) - 150, Math.floor(len / 2) + 150);
|
|
190
|
+
const end = normalized.slice(-300);
|
|
191
|
+
return `${start}|${middle}|${end}`;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Calculate similarity between two fingerprints (0-1)
|
|
195
|
+
*/
|
|
196
|
+
export function calculateSimilarity(fp1, fp2) {
|
|
197
|
+
if (fp1 === fp2)
|
|
198
|
+
return 1;
|
|
199
|
+
if (!fp1 || !fp2)
|
|
200
|
+
return 0;
|
|
201
|
+
// Use Jaccard similarity on word sets
|
|
202
|
+
const words1 = new Set(fp1.split(/\s+/).filter(w => w.length > 3));
|
|
203
|
+
const words2 = new Set(fp2.split(/\s+/).filter(w => w.length > 3));
|
|
204
|
+
if (words1.size === 0 || words2.size === 0)
|
|
205
|
+
return 0;
|
|
206
|
+
let intersection = 0;
|
|
207
|
+
for (const word of words1) {
|
|
208
|
+
if (words2.has(word))
|
|
209
|
+
intersection++;
|
|
210
|
+
}
|
|
211
|
+
const union = words1.size + words2.size - intersection;
|
|
212
|
+
return intersection / union;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Smart deduplication tracker
|
|
216
|
+
*/
|
|
217
|
+
export class DedupTracker {
|
|
218
|
+
// Track canonical paths we've seen (locale-stripped)
|
|
219
|
+
canonicalPaths = new Map();
|
|
220
|
+
// Track content fingerprints
|
|
221
|
+
fingerprints = new Map();
|
|
222
|
+
// Stats
|
|
223
|
+
stats = {
|
|
224
|
+
localeSkipped: 0,
|
|
225
|
+
similarSkipped: 0,
|
|
226
|
+
total: 0,
|
|
227
|
+
};
|
|
228
|
+
// Preferred language (skip other locales if we have this one)
|
|
229
|
+
preferredLanguage;
|
|
230
|
+
constructor(preferredLanguage = 'en') {
|
|
231
|
+
this.preferredLanguage = preferredLanguage;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Check if URL should be skipped (is duplicate)
|
|
235
|
+
* Returns reason if should skip, undefined if should crawl
|
|
236
|
+
*/
|
|
237
|
+
shouldSkip(url) {
|
|
238
|
+
const localeInfo = extractLocale(url);
|
|
239
|
+
const domain = new URL(url).hostname;
|
|
240
|
+
const key = `${domain}${localeInfo.canonicalPath}`;
|
|
241
|
+
// Check if we've seen this canonical path
|
|
242
|
+
const existing = this.canonicalPaths.get(key);
|
|
243
|
+
if (existing) {
|
|
244
|
+
// We have this path already
|
|
245
|
+
if (localeInfo.hasLocale) {
|
|
246
|
+
// This is a localized version
|
|
247
|
+
const existingLocale = extractLocale(existing.url);
|
|
248
|
+
// Prefer English or non-localized over other locales
|
|
249
|
+
if (existingLocale.language === this.preferredLanguage || !existingLocale.hasLocale) {
|
|
250
|
+
this.stats.localeSkipped++;
|
|
251
|
+
return { skip: true, reason: `locale:${localeInfo.locale}` };
|
|
252
|
+
}
|
|
253
|
+
// If this one is preferred language and existing isn't, replace
|
|
254
|
+
if (localeInfo.language === this.preferredLanguage) {
|
|
255
|
+
this.canonicalPaths.set(key, { url, locale: localeInfo.locale });
|
|
256
|
+
return { skip: false };
|
|
257
|
+
}
|
|
258
|
+
// Both are non-preferred locales, skip this one
|
|
259
|
+
this.stats.localeSkipped++;
|
|
260
|
+
return { skip: true, reason: `locale:${localeInfo.locale}` };
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
// Track this path
|
|
264
|
+
this.canonicalPaths.set(key, { url, locale: localeInfo.locale });
|
|
265
|
+
this.stats.total++;
|
|
266
|
+
return { skip: false };
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Check content similarity against previously seen content
|
|
270
|
+
*/
|
|
271
|
+
checkContentSimilarity(url, content, threshold = 0.85) {
|
|
272
|
+
const fingerprint = generateFingerprint(content);
|
|
273
|
+
// Check against existing fingerprints
|
|
274
|
+
for (const [existingUrl, existingFp] of this.fingerprints) {
|
|
275
|
+
const similarity = calculateSimilarity(fingerprint, existingFp);
|
|
276
|
+
if (similarity >= threshold) {
|
|
277
|
+
this.stats.similarSkipped++;
|
|
278
|
+
return { skip: true, reason: `similar:${(similarity * 100).toFixed(0)}%` };
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// Store this fingerprint
|
|
282
|
+
this.fingerprints.set(url, fingerprint);
|
|
283
|
+
return { skip: false };
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Get dedup statistics
|
|
287
|
+
*/
|
|
288
|
+
getStats() {
|
|
289
|
+
return {
|
|
290
|
+
...this.stats,
|
|
291
|
+
uniquePaths: this.canonicalPaths.size,
|
|
292
|
+
uniqueContent: this.fingerprints.size,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=dedup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup.js","sourceRoot":"","sources":["../../../src/utils/dedup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iCAAiC;AACjC,MAAM,eAAe,GAAG;IACtB,+CAA+C;IAC/C,0BAA0B;IAC1B,gCAAgC;IAChC,0BAA0B;IAC1B,4CAA4C;IAC5C,2BAA2B;IAC3B,uCAAuC;IACvC,uDAAuD;CACxD,CAAC;AAEF,mCAAmC;AACnC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,wBAAwB;IACxB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACtE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACtE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACtE,mBAAmB;IACnB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACpD,kBAAkB;IAClB,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IA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BAAmB,CAAC,OAAO,CAAC,CAAC;QAEjD,sCAAsC;QACtC,KAAK,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1D,MAAM,UAAU,GAAG,mBAAmB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;YAChE,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;gBAC5B,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;gBAC5B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;YAC7E,CAAC;QACH,CAAC;QAED,yBAAyB;QACzB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;QACxC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO;YACL,GAAG,IAAI,CAAC,KAAK;YACb,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI;YACrC,aAAa,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI;SACtC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
info: (msg: string) => void;
|
|
3
|
+
success: (msg: string) => void;
|
|
4
|
+
error: (msg: string) => void;
|
|
5
|
+
warn: (msg: string) => void;
|
|
6
|
+
dim: (msg: string) => void;
|
|
7
|
+
progress: (current: number, total: number, label: string) => void;
|
|
8
|
+
status: (msg: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function setLogMode(quiet: boolean, verbose: boolean): void;
|
|
11
|
+
export declare function createLogger(): Logger;
|
|
12
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AAKD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAGjE;AAED,wBAAgB,YAAY,IAAI,MAAM,CAqCrC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
let quietMode = false;
|
|
3
|
+
let verboseMode = false;
|
|
4
|
+
export function setLogMode(quiet, verbose) {
|
|
5
|
+
quietMode = quiet;
|
|
6
|
+
verboseMode = verbose;
|
|
7
|
+
}
|
|
8
|
+
export function createLogger() {
|
|
9
|
+
return {
|
|
10
|
+
info: (msg) => {
|
|
11
|
+
if (!quietMode)
|
|
12
|
+
console.log(msg);
|
|
13
|
+
},
|
|
14
|
+
success: (msg) => {
|
|
15
|
+
if (!quietMode)
|
|
16
|
+
console.log(chalk.green(msg));
|
|
17
|
+
},
|
|
18
|
+
error: (msg) => {
|
|
19
|
+
console.error(chalk.red(msg));
|
|
20
|
+
},
|
|
21
|
+
warn: (msg) => {
|
|
22
|
+
if (!quietMode)
|
|
23
|
+
console.log(chalk.yellow(msg));
|
|
24
|
+
},
|
|
25
|
+
dim: (msg) => {
|
|
26
|
+
if (verboseMode)
|
|
27
|
+
console.log(chalk.dim(msg));
|
|
28
|
+
},
|
|
29
|
+
progress: (current, total, label) => {
|
|
30
|
+
if (quietMode)
|
|
31
|
+
return;
|
|
32
|
+
const width = 20;
|
|
33
|
+
const filled = Math.round((current / total) * width);
|
|
34
|
+
const bar = '\u2593'.repeat(filled) + '\u2591'.repeat(width - filled);
|
|
35
|
+
// Clear line and write progress
|
|
36
|
+
process.stdout.write(`\r ${bar} ${current}/${total} ${label.slice(0, 40)}`);
|
|
37
|
+
if (current >= total) {
|
|
38
|
+
process.stdout.write('\n');
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
status: (msg) => {
|
|
42
|
+
if (quietMode)
|
|
43
|
+
return;
|
|
44
|
+
// Show status on new line (will be overwritten by next progress)
|
|
45
|
+
process.stdout.write(`\r ${chalk.cyan('⋯')} ${msg.padEnd(55)}`);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,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MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,OAAO,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;YAE7E,IAAI,OAAO,IAAI,KAAK,EAAE,CAAC;gBACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QACD,MAAM,EAAE,CAAC,GAAW,EAAE,EAAE;YACtB,IAAI,SAAS;gBAAE,OAAO;YACtB,iEAAiE;YACjE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACnE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beautiful terminal UI for maw
|
|
3
|
+
* Clean, minimal, production-ready
|
|
4
|
+
*/
|
|
5
|
+
declare const theme: {
|
|
6
|
+
primary: import("chalk").ChalkInstance;
|
|
7
|
+
success: import("chalk").ChalkInstance;
|
|
8
|
+
warning: import("chalk").ChalkInstance;
|
|
9
|
+
error: import("chalk").ChalkInstance;
|
|
10
|
+
muted: import("chalk").ChalkInstance;
|
|
11
|
+
accent: import("chalk").ChalkInstance;
|
|
12
|
+
info: import("chalk").ChalkInstance;
|
|
13
|
+
dim: import("chalk").ChalkInstance;
|
|
14
|
+
bold: import("chalk").ChalkInstance;
|
|
15
|
+
white: import("chalk").ChalkInstance;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Format bytes to human readable
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatBytes(bytes: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* Format duration to human readable
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatDuration(ms: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Create a smooth progress bar
|
|
27
|
+
*/
|
|
28
|
+
export declare function progressBar(current: number, total: number, width?: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Clean header - no box, just styled text
|
|
31
|
+
*/
|
|
32
|
+
export declare function header(title: string, subtitle?: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Crawl progress line - clean and minimal
|
|
35
|
+
*/
|
|
36
|
+
export declare function crawlProgress(current: number, total: number, title: string, status?: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Success message - clean layout
|
|
39
|
+
*/
|
|
40
|
+
export declare function successMessage(output: string, size: number, pages: number, duration: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* Engine stats display
|
|
43
|
+
*/
|
|
44
|
+
export declare function engineStats(stats: {
|
|
45
|
+
fetch: number;
|
|
46
|
+
playwright: number;
|
|
47
|
+
rebrowser: number;
|
|
48
|
+
blocked: number;
|
|
49
|
+
}): string;
|
|
50
|
+
/**
|
|
51
|
+
* Dedup stats display
|
|
52
|
+
*/
|
|
53
|
+
export declare function dedupStats(stats: {
|
|
54
|
+
localeSkipped: number;
|
|
55
|
+
similarSkipped: number;
|
|
56
|
+
total: number;
|
|
57
|
+
}): string;
|
|
58
|
+
/**
|
|
59
|
+
* Warning message for size limit
|
|
60
|
+
*/
|
|
61
|
+
export declare function limitWarning(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Cloud sync message
|
|
64
|
+
*/
|
|
65
|
+
export declare function cloudSyncMessage(memoryId: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Error message
|
|
68
|
+
*/
|
|
69
|
+
export declare function errorMessage(message: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Maw banner - minimal and clean
|
|
72
|
+
*/
|
|
73
|
+
export declare function banner(): string;
|
|
74
|
+
/**
|
|
75
|
+
* Preview results display
|
|
76
|
+
*/
|
|
77
|
+
export declare function previewResults(result: {
|
|
78
|
+
domain: string;
|
|
79
|
+
totalPages: number;
|
|
80
|
+
hasSitemap: boolean;
|
|
81
|
+
estimatedSize?: string;
|
|
82
|
+
recentPages: Array<{
|
|
83
|
+
url: string;
|
|
84
|
+
lastmod?: string;
|
|
85
|
+
}>;
|
|
86
|
+
}): string;
|
|
87
|
+
/**
|
|
88
|
+
* Search results display
|
|
89
|
+
*/
|
|
90
|
+
export declare function searchResults(hits: Array<{
|
|
91
|
+
title: string;
|
|
92
|
+
metadata?: {
|
|
93
|
+
url?: string;
|
|
94
|
+
};
|
|
95
|
+
score?: number;
|
|
96
|
+
}>): string;
|
|
97
|
+
/**
|
|
98
|
+
* Ask result display
|
|
99
|
+
*/
|
|
100
|
+
export declare function askResult(answer: string, sources?: Array<{
|
|
101
|
+
title?: string;
|
|
102
|
+
url?: string;
|
|
103
|
+
}>): string;
|
|
104
|
+
/**
|
|
105
|
+
* List documents display
|
|
106
|
+
*/
|
|
107
|
+
export declare function listDocuments(items: Array<{
|
|
108
|
+
title?: string;
|
|
109
|
+
url?: string;
|
|
110
|
+
preview?: string;
|
|
111
|
+
page?: number | string;
|
|
112
|
+
}>): string;
|
|
113
|
+
/**
|
|
114
|
+
* Stats panel for detailed view
|
|
115
|
+
*/
|
|
116
|
+
export declare function statsPanel(stats: Record<string, string | number>): string;
|
|
117
|
+
/**
|
|
118
|
+
* Summary table
|
|
119
|
+
*/
|
|
120
|
+
export declare function summaryTable(rows: Array<{
|
|
121
|
+
label: string;
|
|
122
|
+
value: string | number;
|
|
123
|
+
color?: 'success' | 'warning' | 'error' | 'info';
|
|
124
|
+
}>): string;
|
|
125
|
+
export { theme };
|
|
126
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/utils/ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,QAAA,MAAM,KAAK;;;;;;;;;;;CAWV,CAAC;AAaF;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED;;GAE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