@djangocfg/seo 2.1.50
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 +192 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +3780 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/crawler/index.d.ts +88 -0
- package/dist/crawler/index.mjs +610 -0
- package/dist/crawler/index.mjs.map +1 -0
- package/dist/google-console/index.d.ts +95 -0
- package/dist/google-console/index.mjs +539 -0
- package/dist/google-console/index.mjs.map +1 -0
- package/dist/index.d.ts +285 -0
- package/dist/index.mjs +3236 -0
- package/dist/index.mjs.map +1 -0
- package/dist/link-checker/index.d.ts +76 -0
- package/dist/link-checker/index.mjs +326 -0
- package/dist/link-checker/index.mjs.map +1 -0
- package/dist/markdown-report-B3QdDzxE.d.ts +193 -0
- package/dist/reports/index.d.ts +24 -0
- package/dist/reports/index.mjs +836 -0
- package/dist/reports/index.mjs.map +1 -0
- package/dist/routes/index.d.ts +69 -0
- package/dist/routes/index.mjs +372 -0
- package/dist/routes/index.mjs.map +1 -0
- package/dist/scanner-Cz4Th2Pt.d.ts +60 -0
- package/dist/types/index.d.ts +144 -0
- package/dist/types/index.mjs +3 -0
- package/dist/types/index.mjs.map +1 -0
- package/package.json +114 -0
- package/src/analyzer.ts +256 -0
- package/src/cli/commands/audit.ts +260 -0
- package/src/cli/commands/content.ts +180 -0
- package/src/cli/commands/crawl.ts +32 -0
- package/src/cli/commands/index.ts +12 -0
- package/src/cli/commands/inspect.ts +60 -0
- package/src/cli/commands/links.ts +41 -0
- package/src/cli/commands/robots.ts +36 -0
- package/src/cli/commands/routes.ts +126 -0
- package/src/cli/commands/sitemap.ts +48 -0
- package/src/cli/index.ts +149 -0
- package/src/cli/types.ts +40 -0
- package/src/config.ts +207 -0
- package/src/content/index.ts +51 -0
- package/src/content/link-checker.ts +182 -0
- package/src/content/link-fixer.ts +188 -0
- package/src/content/scanner.ts +200 -0
- package/src/content/sitemap-generator.ts +321 -0
- package/src/content/types.ts +140 -0
- package/src/crawler/crawler.ts +425 -0
- package/src/crawler/index.ts +10 -0
- package/src/crawler/robots-parser.ts +171 -0
- package/src/crawler/sitemap-validator.ts +204 -0
- package/src/google-console/analyzer.ts +317 -0
- package/src/google-console/auth.ts +100 -0
- package/src/google-console/client.ts +281 -0
- package/src/google-console/index.ts +9 -0
- package/src/index.ts +144 -0
- package/src/link-checker/index.ts +461 -0
- package/src/reports/claude-context.ts +149 -0
- package/src/reports/generator.ts +244 -0
- package/src/reports/index.ts +27 -0
- package/src/reports/json-report.ts +320 -0
- package/src/reports/markdown-report.ts +246 -0
- package/src/reports/split-report.ts +252 -0
- package/src/routes/analyzer.ts +324 -0
- package/src/routes/index.ts +25 -0
- package/src/routes/scanner.ts +298 -0
- package/src/types/index.ts +222 -0
- package/src/utils/index.ts +154 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { GoogleConsoleClient } from './google-console/index.js';
|
|
2
|
+
export { analyzeInspectionResults, createAuthClient, verifyAuth } from './google-console/index.js';
|
|
3
|
+
import { SeoModuleConfig, SeoReport, SeoIssue, UrlInspectionResult, CrawlResult } from './types/index.js';
|
|
4
|
+
export { CoverageState, CrawlerConfig, GoogleConsoleConfig, IndexingState, IndexingVerdict, IssueCategory, IssueSeverity, PageFetchState, Recommendation, ReportSummary, RobotsTxtState } from './types/index.js';
|
|
5
|
+
export { SiteCrawler, analyzeAllSitemaps, analyzeCrawlResults, analyzeRobotsTxt, analyzeSitemap, isUrlAllowed } from './crawler/index.js';
|
|
6
|
+
export { CheckLinksOptions, CheckLinksResult, checkLinks, linkResultsToSeoIssues } from './link-checker/index.js';
|
|
7
|
+
export { A as AI_REPORT_SCHEMA, c as generateAiSummary, g as generateAndSaveReports, a as generateJsonReport, b as generateMarkdownReport, m as mergeReports, p as printReportSummary } from './markdown-report-B3QdDzxE.js';
|
|
8
|
+
export { R as RouteInfo, a as ScanOptions, S as ScanResult, f as findAppDir, g as getStaticUrls, r as routeToUrl, s as scanRoutes } from './scanner-Cz4Th2Pt.js';
|
|
9
|
+
import '@googleapis/searchconsole';
|
|
10
|
+
import 'google-auth-library';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @djangocfg/seo - Main Analyzer
|
|
14
|
+
* High-level SEO analysis orchestrator
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface AnalyzeOptions {
|
|
18
|
+
includeGoogleConsole?: boolean;
|
|
19
|
+
includeCrawler?: boolean;
|
|
20
|
+
includeRobotsTxt?: boolean;
|
|
21
|
+
includeSitemap?: boolean;
|
|
22
|
+
crawlerMaxPages?: number;
|
|
23
|
+
crawlerMaxDepth?: number;
|
|
24
|
+
urlsToInspect?: string[];
|
|
25
|
+
}
|
|
26
|
+
interface AnalyzeResult {
|
|
27
|
+
report: SeoReport;
|
|
28
|
+
issues: SeoIssue[];
|
|
29
|
+
urlInspections: UrlInspectionResult[];
|
|
30
|
+
crawlResults: CrawlResult[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Main SEO Analyzer class
|
|
34
|
+
* Combines all modules for comprehensive SEO analysis
|
|
35
|
+
*/
|
|
36
|
+
declare class SeoAnalyzer {
|
|
37
|
+
private config;
|
|
38
|
+
private siteUrl;
|
|
39
|
+
private gscClient?;
|
|
40
|
+
constructor(config: SeoModuleConfig & {
|
|
41
|
+
siteUrl: string;
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Run full SEO analysis
|
|
45
|
+
*/
|
|
46
|
+
analyze(options?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Save report to files
|
|
49
|
+
*/
|
|
50
|
+
saveReport(outputDir?: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Quick health check
|
|
53
|
+
*/
|
|
54
|
+
healthCheck(): Promise<{
|
|
55
|
+
healthScore: number;
|
|
56
|
+
criticalIssues: number;
|
|
57
|
+
errors: number;
|
|
58
|
+
warnings: number;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Inspect specific URLs
|
|
62
|
+
*/
|
|
63
|
+
inspectUrls(urls: string[]): Promise<UrlInspectionResult[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Get Google Console client
|
|
66
|
+
*/
|
|
67
|
+
getGoogleConsoleClient(): GoogleConsoleClient | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @djangocfg/seo - Utilities
|
|
72
|
+
* Shared utility functions
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* Load URLs from a file (one URL per line)
|
|
76
|
+
*/
|
|
77
|
+
declare function loadUrlsFromFile(filePath: string): string[];
|
|
78
|
+
/**
|
|
79
|
+
* Normalize URL for comparison
|
|
80
|
+
*/
|
|
81
|
+
declare function normalizeUrl(url: string, baseUrl?: string): string;
|
|
82
|
+
/**
|
|
83
|
+
* Check if URL belongs to the same domain
|
|
84
|
+
*/
|
|
85
|
+
declare function isSameDomain(url: string, baseUrl: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Format bytes to human readable string
|
|
88
|
+
*/
|
|
89
|
+
declare function formatBytes(bytes: number): string;
|
|
90
|
+
/**
|
|
91
|
+
* Format milliseconds to human readable string
|
|
92
|
+
*/
|
|
93
|
+
declare function formatDuration(ms: number): string;
|
|
94
|
+
/**
|
|
95
|
+
* Chunk array into smaller arrays
|
|
96
|
+
*/
|
|
97
|
+
declare function chunk<T>(array: T[], size: number): T[][];
|
|
98
|
+
/**
|
|
99
|
+
* Sleep for a given number of milliseconds
|
|
100
|
+
*/
|
|
101
|
+
declare function sleep(ms: number): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Retry a function with exponential backoff
|
|
104
|
+
*/
|
|
105
|
+
declare function retry<T>(fn: () => Promise<T>, options?: {
|
|
106
|
+
retries?: number;
|
|
107
|
+
minTimeout?: number;
|
|
108
|
+
maxTimeout?: number;
|
|
109
|
+
factor?: number;
|
|
110
|
+
}): Promise<T>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Content module types for MDX/Nextra projects
|
|
114
|
+
*/
|
|
115
|
+
interface ContentConfig {
|
|
116
|
+
/** Content directory path (default: 'content') */
|
|
117
|
+
contentDir: string;
|
|
118
|
+
/** App directory path (default: 'app') */
|
|
119
|
+
appDir: string;
|
|
120
|
+
/** Base URL path for docs (default: '/docs') */
|
|
121
|
+
basePath: string;
|
|
122
|
+
/** File extensions to scan (default: ['.mdx', '.md']) */
|
|
123
|
+
extensions: string[];
|
|
124
|
+
/** Asset extensions to ignore in links */
|
|
125
|
+
assetExtensions: string[];
|
|
126
|
+
}
|
|
127
|
+
interface SitemapConfig {
|
|
128
|
+
/** Output file path (default: 'app/_core/sitemap.ts') */
|
|
129
|
+
output: string;
|
|
130
|
+
/** Include app pages in sitemap */
|
|
131
|
+
includeApp: boolean;
|
|
132
|
+
/** Include content pages in sitemap */
|
|
133
|
+
includeContent: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface SitemapItem {
|
|
136
|
+
title: string;
|
|
137
|
+
path: string;
|
|
138
|
+
children?: SitemapItem[];
|
|
139
|
+
}
|
|
140
|
+
interface SitemapData {
|
|
141
|
+
app: SitemapItem[];
|
|
142
|
+
docs: SitemapItem[];
|
|
143
|
+
}
|
|
144
|
+
type LinkType = 'absolute' | 'dotslash' | 'parent' | 'simple';
|
|
145
|
+
interface BrokenLink {
|
|
146
|
+
/** File containing the broken link */
|
|
147
|
+
file: string;
|
|
148
|
+
/** Full link path (e.g., /docs/path) */
|
|
149
|
+
link: string;
|
|
150
|
+
/** Link type */
|
|
151
|
+
type: LinkType;
|
|
152
|
+
/** Raw link text */
|
|
153
|
+
raw: string;
|
|
154
|
+
/** Line number */
|
|
155
|
+
line: number;
|
|
156
|
+
}
|
|
157
|
+
interface LinkCheckResult {
|
|
158
|
+
/** Total files checked */
|
|
159
|
+
filesChecked: number;
|
|
160
|
+
/** Unique links checked */
|
|
161
|
+
uniqueLinks: number;
|
|
162
|
+
/** Broken links found */
|
|
163
|
+
brokenLinks: BrokenLink[];
|
|
164
|
+
/** All links are valid */
|
|
165
|
+
success: boolean;
|
|
166
|
+
}
|
|
167
|
+
interface LinkFix {
|
|
168
|
+
/** Original link */
|
|
169
|
+
from: string;
|
|
170
|
+
/** Replacement link */
|
|
171
|
+
to: string;
|
|
172
|
+
/** Line number */
|
|
173
|
+
line: number;
|
|
174
|
+
}
|
|
175
|
+
interface LinkFixResult {
|
|
176
|
+
/** File path */
|
|
177
|
+
file: string;
|
|
178
|
+
/** Full path to file */
|
|
179
|
+
fullPath: string;
|
|
180
|
+
/** Fixes applied/suggested */
|
|
181
|
+
fixes: LinkFix[];
|
|
182
|
+
}
|
|
183
|
+
interface FixLinksResult {
|
|
184
|
+
/** Total changes made/suggested */
|
|
185
|
+
totalChanges: number;
|
|
186
|
+
/** Files with changes */
|
|
187
|
+
fileChanges: LinkFixResult[];
|
|
188
|
+
/** Whether fixes were applied */
|
|
189
|
+
applied: boolean;
|
|
190
|
+
}
|
|
191
|
+
interface ContentScanResult {
|
|
192
|
+
/** Project type detected */
|
|
193
|
+
projectType: 'nextra' | 'nextjs' | 'unknown';
|
|
194
|
+
/** Content directory found */
|
|
195
|
+
hasContent: boolean;
|
|
196
|
+
/** App directory found */
|
|
197
|
+
hasApp: boolean;
|
|
198
|
+
/** MDX files found */
|
|
199
|
+
mdxFiles: string[];
|
|
200
|
+
/** Page files found in app/ */
|
|
201
|
+
pageFiles: string[];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Content scanner for MDX/Nextra projects
|
|
206
|
+
* Scans content/ and app/ directories for files
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Detect project type based on directory structure
|
|
211
|
+
*/
|
|
212
|
+
declare function detectProjectType(cwd: string): 'nextra' | 'nextjs' | 'unknown';
|
|
213
|
+
/**
|
|
214
|
+
* Scan project and return content information
|
|
215
|
+
*/
|
|
216
|
+
declare function scanProject(cwd: string, config?: Partial<ContentConfig>): ContentScanResult;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Link checker for MDX documentation
|
|
220
|
+
* Checks all internal links in content/ folder and verifies pages exist
|
|
221
|
+
* Properly handles Nextra's routing behavior for relative links
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Check all links in content directory
|
|
226
|
+
*/
|
|
227
|
+
declare function checkContentLinks(contentDir: string, config?: Partial<ContentConfig>): LinkCheckResult;
|
|
228
|
+
/**
|
|
229
|
+
* Group broken links by file for display
|
|
230
|
+
*/
|
|
231
|
+
declare function groupBrokenLinksByFile(brokenLinks: BrokenLink[]): Map<string, BrokenLink[]>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Link fixer for MDX documentation
|
|
235
|
+
* Converts absolute /docs/ links to relative when appropriate
|
|
236
|
+
*
|
|
237
|
+
* Nextra routing rules:
|
|
238
|
+
* - index.mdx at /foo/ -> ./bar resolves to /foo/bar ✓
|
|
239
|
+
* - page.mdx at /foo/page -> ./bar resolves to /foo/page/bar ✗ (browser behavior)
|
|
240
|
+
*
|
|
241
|
+
* So for non-index files linking to siblings, we need ../sibling
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Fix absolute links to relative in content directory
|
|
246
|
+
*/
|
|
247
|
+
declare function fixContentLinks(contentDir: string, options?: {
|
|
248
|
+
apply?: boolean;
|
|
249
|
+
config?: Partial<ContentConfig>;
|
|
250
|
+
}): FixLinksResult;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Universal Sitemap Generator for Next.js App Router projects
|
|
254
|
+
* Supports both Nextra (MDX content) and standard Next.js projects
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Generate sitemap data from project
|
|
259
|
+
* Auto-detects project type (Nextra vs standard Next.js)
|
|
260
|
+
*/
|
|
261
|
+
declare function generateSitemapData(cwd: string, config?: Partial<ContentConfig>): Promise<SitemapData>;
|
|
262
|
+
/**
|
|
263
|
+
* Generate and save sitemap file
|
|
264
|
+
*/
|
|
265
|
+
declare function generateSitemap(cwd: string, options?: {
|
|
266
|
+
output?: string;
|
|
267
|
+
config?: Partial<ContentConfig>;
|
|
268
|
+
}): Promise<{
|
|
269
|
+
outputPath: string;
|
|
270
|
+
data: SitemapData;
|
|
271
|
+
}>;
|
|
272
|
+
/**
|
|
273
|
+
* Flatten sitemap items to list of paths
|
|
274
|
+
*/
|
|
275
|
+
declare function flattenSitemap(items: SitemapItem[]): string[];
|
|
276
|
+
/**
|
|
277
|
+
* Count total items in sitemap
|
|
278
|
+
*/
|
|
279
|
+
declare function countSitemapItems(data: SitemapData): {
|
|
280
|
+
app: number;
|
|
281
|
+
docs: number;
|
|
282
|
+
total: number;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export { type BrokenLink, type ContentConfig, type ContentScanResult, CrawlResult, type FixLinksResult, GoogleConsoleClient, type LinkCheckResult, SeoAnalyzer, SeoIssue, SeoModuleConfig, SeoReport, type SitemapConfig, type SitemapData, type SitemapItem, UrlInspectionResult, checkContentLinks, chunk, countSitemapItems, detectProjectType, fixContentLinks, flattenSitemap, formatBytes, formatDuration, generateSitemap, generateSitemapData, groupBrokenLinksByFile, isSameDomain, loadUrlsFromFile, normalizeUrl, retry, scanProject, sleep };
|