@ebowwa/markdown-docs-scraper 1.1.0 → 1.2.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/README.md +82 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1 -0
- package/dist/index.d.ts +128 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +219 -26
- package/dist/scrapers/github-raw.d.ts +9 -0
- package/dist/scrapers/github-raw.d.ts.map +1 -0
- package/dist/scrapers/index.d.ts +11 -0
- package/dist/scrapers/index.d.ts.map +1 -0
- package/dist/scrapers/index.js +448 -0
- package/dist/scrapers/llms-txt.d.ts +13 -0
- package/dist/scrapers/llms-txt.d.ts.map +1 -0
- package/dist/scrapers/registry.d.ts +23 -0
- package/dist/scrapers/registry.d.ts.map +1 -0
- package/dist/scrapers/types.d.ts +57 -0
- package/dist/scrapers/types.d.ts.map +1 -0
- package/package.json +10 -2
- package/src/cli.js +160 -0
- package/src/cli.ts +2 -0
- package/src/index.js +487 -0
- package/src/index.ts +115 -28
- package/src/scrapers/github-raw.ts +154 -0
- package/src/scrapers/index.ts +16 -0
- package/src/scrapers/llms-txt.ts +101 -0
- package/src/scrapers/registry.ts +55 -0
- package/src/scrapers/types.ts +79 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scraper Types
|
|
3
|
+
*
|
|
4
|
+
* Core types for the composable scraper architecture.
|
|
5
|
+
* These types define the interface that all scrapers must implement.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// SOURCE TYPES
|
|
10
|
+
// ============================================================================
|
|
11
|
+
|
|
12
|
+
/** Supported documentation source types */
|
|
13
|
+
export type SourceType = "llms-txt" | "github-raw";
|
|
14
|
+
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// SCRAPER INTERFACE
|
|
17
|
+
// ============================================================================
|
|
18
|
+
|
|
19
|
+
/** Result from scraping a source */
|
|
20
|
+
export interface ScrapeResult {
|
|
21
|
+
downloaded: DownloadResult[];
|
|
22
|
+
failed: Array<{ url: string; error: string }>;
|
|
23
|
+
duration?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Individual download result */
|
|
27
|
+
export interface DownloadResult {
|
|
28
|
+
success: boolean;
|
|
29
|
+
path: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Scraper interface - all scrapers must implement this */
|
|
34
|
+
export interface Scraper {
|
|
35
|
+
/** Source type identifier */
|
|
36
|
+
type: SourceType;
|
|
37
|
+
|
|
38
|
+
/** Scrape documentation from a source */
|
|
39
|
+
scrape(config: SourceConfig): Promise<ScrapeResult>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// SOURCE CONFIG
|
|
44
|
+
// ============================================================================
|
|
45
|
+
|
|
46
|
+
/** Source configuration */
|
|
47
|
+
export interface SourceConfig {
|
|
48
|
+
/** Display name */
|
|
49
|
+
name: string;
|
|
50
|
+
|
|
51
|
+
/** Source type - determines which scraper to use */
|
|
52
|
+
sourceType: SourceType;
|
|
53
|
+
|
|
54
|
+
/** Base URL for the documentation */
|
|
55
|
+
baseUrl: string;
|
|
56
|
+
|
|
57
|
+
/** Path to docs (e.g., /docs, /docs/en) */
|
|
58
|
+
docsPath: string;
|
|
59
|
+
|
|
60
|
+
/** Output directory for downloaded docs */
|
|
61
|
+
outputDir: string;
|
|
62
|
+
|
|
63
|
+
/** Output directory for daily reports */
|
|
64
|
+
reportDir: string;
|
|
65
|
+
|
|
66
|
+
/** llms.txt path (for llms-txt sources) */
|
|
67
|
+
llmsTxtPath?: string;
|
|
68
|
+
|
|
69
|
+
/** Custom link pattern for llms.txt parsing */
|
|
70
|
+
linkPattern?: RegExp;
|
|
71
|
+
|
|
72
|
+
/** GitHub config (for github-raw sources or GitHub API data) */
|
|
73
|
+
github?: {
|
|
74
|
+
repo: string;
|
|
75
|
+
includeCommits: boolean;
|
|
76
|
+
includeReleases: boolean;
|
|
77
|
+
includePRs: boolean;
|
|
78
|
+
};
|
|
79
|
+
}
|