webcrawl 1.4.0 → 1.4.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/dist/bin.js +0 -0
- package/dist/core/local-engine.d.ts +5 -0
- package/dist/core/local-engine.js +21 -5
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
File without changes
|
|
@@ -32,4 +32,9 @@ export interface LocalEngineBackend {
|
|
|
32
32
|
targets(): Promise<Record<string, unknown>>;
|
|
33
33
|
usage(): Promise<Record<string, unknown>>;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Apply `map --filter` / `search` after discovery, then honour `-n` / `limit`.
|
|
37
|
+
* Matching is a case-insensitive substring of the URL. Exported for unit tests.
|
|
38
|
+
*/
|
|
39
|
+
export declare function filterMappedLinks(links: string[], search?: string, limit?: number): string[];
|
|
35
40
|
export declare function createLocalEngineClient(): LocalEngineBackend;
|
|
@@ -29,6 +29,20 @@ function safeDomainOf(url) {
|
|
|
29
29
|
return "";
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Apply `map --filter` / `search` after discovery, then honour `-n` / `limit`.
|
|
34
|
+
* Matching is a case-insensitive substring of the URL. Exported for unit tests.
|
|
35
|
+
*/
|
|
36
|
+
export function filterMappedLinks(links, search, limit = 100) {
|
|
37
|
+
const cap = Math.max(1, limit);
|
|
38
|
+
const needle = search?.trim().toLowerCase();
|
|
39
|
+
const filtered = needle
|
|
40
|
+
? links.filter((l) => l.toLowerCase().includes(needle))
|
|
41
|
+
: links;
|
|
42
|
+
return filtered.slice(0, cap);
|
|
43
|
+
}
|
|
44
|
+
/** How many URLs to discover before applying `--filter`, so a small `-n` cannot hide matches. */
|
|
45
|
+
const MAP_FILTER_DISCOVER_LIMIT = 5000;
|
|
32
46
|
export function createLocalEngineClient() {
|
|
33
47
|
return {
|
|
34
48
|
baseUrl: "local://engine",
|
|
@@ -369,13 +383,15 @@ export function createLocalEngineClient() {
|
|
|
369
383
|
},
|
|
370
384
|
async map(p) {
|
|
371
385
|
const targetUrl = /^https?:\/\//i.test(p.url) ? p.url : `https://${p.url}`;
|
|
386
|
+
const limit = Math.max(1, p.limit ?? 100);
|
|
387
|
+
const needle = p.search?.trim();
|
|
388
|
+
// Discover first (widely when filtering), then apply search and limit so
|
|
389
|
+
// `map --filter webhooks -n 10` can still find /webhooks/* URLs that are
|
|
390
|
+
// not among the first 10 sitemap entries (#11).
|
|
372
391
|
const mapped = await mapWebsiteUrls(targetUrl, {
|
|
373
|
-
limit:
|
|
392
|
+
limit: needle ? Math.max(limit, MAP_FILTER_DISCOVER_LIMIT) : limit,
|
|
374
393
|
});
|
|
375
|
-
const
|
|
376
|
-
const links = needle
|
|
377
|
-
? mapped.links.filter((l) => l.toLowerCase().includes(needle))
|
|
378
|
-
: mapped.links;
|
|
394
|
+
const links = filterMappedLinks(mapped.links, needle, limit);
|
|
379
395
|
return {
|
|
380
396
|
success: true,
|
|
381
397
|
mode: "local",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webcrawl",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Webcrawl Anything CLI & Core Engine — crawl, search, and extract structured evidence from any website, SPA, PDF, Office file, YouTube video, GitHub repo, ArXiv paper, or CVE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -127,8 +127,8 @@
|
|
|
127
127
|
"@ai-sdk/gateway": "^4.0.123",
|
|
128
128
|
"@firecrawl/pdf-inspector": "^1.25.2",
|
|
129
129
|
"@vercel/sandbox": "^1.0.0",
|
|
130
|
-
"@webcrawl/client": "^1.4.
|
|
131
|
-
"@webcrawl/curl-impersonate": "^1.4.
|
|
130
|
+
"@webcrawl/client": "^1.4.1",
|
|
131
|
+
"@webcrawl/curl-impersonate": "^1.4.1",
|
|
132
132
|
"ai": "^7.0.150",
|
|
133
133
|
"impit": "^0.14.7",
|
|
134
134
|
"mammoth": "^1.13.0",
|