aeorank 2.3.0 → 2.3.2

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/browser.d.ts CHANGED
@@ -262,12 +262,25 @@ interface RawDataSummary {
262
262
  * Single entry point for all HTTP requests - no redundant fetches.
263
263
  */
264
264
  declare function prefetchSiteData(domain: string): Promise<SiteData>;
265
+ interface SitemapDateAnalysis {
266
+ recentCount: number;
267
+ isUniform: boolean;
268
+ uniformDetail?: string;
269
+ totalWithDates: number;
270
+ distinctRecentDays: number;
271
+ }
272
+ declare function countRecentSitemapDates(sitemapText: string): SitemapDateAnalysis;
265
273
  declare function extractRawDataSummary(data: SiteData): RawDataSummary;
266
274
  /**
267
275
  * Run all 26 criteria checks using pre-fetched site data.
268
276
  * All functions are synchronous (no HTTP calls) - data was already fetched.
269
277
  */
270
278
  declare function auditSiteFromData(data: SiteData): CriterionResult[];
279
+ /**
280
+ * Legacy entry point: fetches data and runs all checks.
281
+ * Used by analyzer.ts for the /api/aeo/analyze endpoint.
282
+ */
283
+ declare function auditSite(targetUrl: string): Promise<CriterionResult[]>;
271
284
 
272
285
  declare function calculateOverallScore(criteria: CriterionResult[]): number;
273
286
 
@@ -521,4 +534,4 @@ interface ComparisonResult {
521
534
  */
522
535
  declare function compare(domainA: string, domainB: string, options?: AuditOptions): Promise<ComparisonResult>;
523
536
 
524
- export { type AuditData, type AuditFinding, type AuditStatus, CRITERION_LABELS, type ComparisonResult, type CrawlOptions, type CrawlResult, type CriterionComparison, type CriterionDetail, type CriterionResult, type Deliverable, type DetailedFinding, type FetchResult, type FindingSeverity, type FindingType, type FixAction, type FixPhase, type FixPlan, type FixPlanSummary, type ImpactLevel, type LinkEdge, type LinkGraph, type LinkGraphStats, type PageCategory$1 as PageCategory, type PageCriterionScore$1 as PageCriterionScore, type PageIssue, type PageNode, type PageReview, type PageScoreResult, type ParkedDomainResult, type PitchMetric, type Priority, type RawDataSummary, type ScoreCardItem, type SerializedLinkGraph, type Severity, type SiteData, type Status, type TopicCluster, analyzeAllPages, analyzePage, auditSiteFromData, buildDetailedFindings, buildLinkGraph, buildScorecard, calculateOverallScore, compare, crawlFullSite, detectParkedDomain, extractAllUrlsFromSitemap, extractContentPagesFromSitemap, extractInternalLinks, extractLinksWithAnchors, extractNavLinks, extractRawDataSummary, fetchMultiPageData, generateBottomLine, generateFixPlan, generateOpportunities, generatePitchNumbers, generateVerdict, inferCategory, prefetchSiteData, scoreAllPages, scorePage, scoreToStatus, serializeLinkGraph };
537
+ export { type AuditData, type AuditFinding, type AuditStatus, CRITERION_LABELS, type ComparisonResult, type CrawlOptions, type CrawlResult, type CriterionComparison, type CriterionDetail, type CriterionResult, type Deliverable, type DetailedFinding, type FetchResult, type FindingSeverity, type FindingType, type FixAction, type FixPhase, type FixPlan, type FixPlanSummary, type ImpactLevel, type LinkEdge, type LinkGraph, type LinkGraphStats, type PageCategory$1 as PageCategory, type PageCriterionScore$1 as PageCriterionScore, type PageIssue, type PageNode, type PageReview, type PageScoreResult, type ParkedDomainResult, type PitchMetric, type Priority, type RawDataSummary, type ScoreCardItem, type SerializedLinkGraph, type Severity, type SiteData, type SitemapDateAnalysis, type Status, type TopicCluster, analyzeAllPages, analyzePage, auditSite, auditSiteFromData, buildDetailedFindings, buildLinkGraph, buildScorecard, calculateOverallScore, compare, countRecentSitemapDates, crawlFullSite, detectParkedDomain, extractAllUrlsFromSitemap, extractContentPagesFromSitemap, extractInternalLinks, extractLinksWithAnchors, extractNavLinks, extractRawDataSummary, fetchMultiPageData, generateBottomLine, generateFixPlan, generateOpportunities, generatePitchNumbers, generateVerdict, inferCategory, prefetchSiteData, scoreAllPages, scorePage, scoreToStatus, serializeLinkGraph };
package/dist/browser.js CHANGED
@@ -185,16 +185,20 @@ async function prefetchSiteData(domain) {
185
185
  }
186
186
  }
187
187
  }
188
- let blogSample = [];
189
- if (sitemapXml && sitemapXml.status === 200) {
190
- let sitemapForBlog = sitemapXml.text;
191
- const subSitemapUrl = extractSubSitemapUrl(sitemapForBlog);
192
- if (subSitemapUrl) {
193
- const subSitemap = await fetchText(subSitemapUrl);
194
- if (subSitemap && subSitemap.status === 200) {
195
- sitemapForBlog = subSitemap.text;
188
+ if (sitemapXml && sitemapXml.status === 200 && sitemapXml.text.includes("<sitemapindex")) {
189
+ const subUrls = extractAllSubSitemapUrls(sitemapXml.text, 5);
190
+ if (subUrls.length > 0) {
191
+ const subResults = await Promise.all(subUrls.map((u) => fetchText(u)));
192
+ for (const sub of subResults) {
193
+ if (sub && sub.status === 200) {
194
+ sitemapXml.text += "\n" + sub.text;
195
+ }
196
196
  }
197
197
  }
198
+ }
199
+ let blogSample = [];
200
+ if (sitemapXml && sitemapXml.status === 200) {
201
+ const sitemapForBlog = sitemapXml.text;
198
202
  const blogUrls = extractBlogUrlsFromSitemap(sitemapForBlog, domain, 50);
199
203
  if (blogUrls.length > 0) {
200
204
  const fetched = await Promise.all(blogUrls.map((url) => fetchText(url)));
@@ -1239,16 +1243,16 @@ function extractBlogUrlsFromSitemap(sitemapText, domain, limit = 50) {
1239
1243
  });
1240
1244
  return candidates.slice(0, limit).map((c) => c.url);
1241
1245
  }
1242
- function extractSubSitemapUrl(sitemapText) {
1243
- if (!sitemapText.includes("<sitemapindex")) return null;
1246
+ function extractAllSubSitemapUrls(sitemapText, limit = 5) {
1247
+ if (!sitemapText.includes("<sitemapindex")) return [];
1244
1248
  const sitemapLocs = sitemapText.match(/<sitemap>[\s\S]*?<loc>([^<]+)<\/loc>[\s\S]*?<\/sitemap>/gi) || [];
1245
- if (sitemapLocs.length === 0) return null;
1246
1249
  const urls = sitemapLocs.map((block) => {
1247
1250
  const match = block.match(/<loc>([^<]+)<\/loc>/i);
1248
1251
  return match ? match[1].trim() : "";
1249
1252
  }).filter(Boolean);
1250
- const preferred = urls.find((u) => /post|blog|article/i.test(u));
1251
- return preferred || urls[0] || null;
1253
+ const preferred = urls.filter((u) => /post|blog|article|page/i.test(u));
1254
+ const rest = urls.filter((u) => !preferred.includes(u));
1255
+ return [...preferred, ...rest].slice(0, limit);
1252
1256
  }
1253
1257
  function checkContentVelocity(data) {
1254
1258
  const findings = [];
@@ -2077,6 +2081,12 @@ function auditSiteFromData(data) {
2077
2081
  checkContentDepth(data, topicCoherence.score)
2078
2082
  ];
2079
2083
  }
2084
+ async function auditSite(targetUrl) {
2085
+ const url = new URL(targetUrl.startsWith("http") ? targetUrl : `https://${targetUrl}`);
2086
+ const domain = url.hostname.replace(/^www\./, "");
2087
+ const data = await prefetchSiteData(domain);
2088
+ return auditSiteFromData(data);
2089
+ }
2080
2090
 
2081
2091
  // src/scoring.ts
2082
2092
  var WEIGHTS = {
@@ -4917,12 +4927,14 @@ export {
4917
4927
  CRITERION_LABELS,
4918
4928
  analyzeAllPages,
4919
4929
  analyzePage,
4930
+ auditSite,
4920
4931
  auditSiteFromData,
4921
4932
  buildDetailedFindings,
4922
4933
  buildLinkGraph,
4923
4934
  buildScorecard,
4924
4935
  calculateOverallScore,
4925
4936
  compare,
4937
+ countRecentSitemapDates,
4926
4938
  crawlFullSite,
4927
4939
  detectParkedDomain,
4928
4940
  extractAllUrlsFromSitemap,