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/index.d.cts CHANGED
@@ -322,12 +322,25 @@ interface RawDataSummary {
322
322
  * Single entry point for all HTTP requests - no redundant fetches.
323
323
  */
324
324
  declare function prefetchSiteData(domain: string): Promise<SiteData>;
325
+ interface SitemapDateAnalysis {
326
+ recentCount: number;
327
+ isUniform: boolean;
328
+ uniformDetail?: string;
329
+ totalWithDates: number;
330
+ distinctRecentDays: number;
331
+ }
332
+ declare function countRecentSitemapDates(sitemapText: string): SitemapDateAnalysis;
325
333
  declare function extractRawDataSummary(data: SiteData): RawDataSummary;
326
334
  /**
327
335
  * Run all 26 criteria checks using pre-fetched site data.
328
336
  * All functions are synchronous (no HTTP calls) - data was already fetched.
329
337
  */
330
338
  declare function auditSiteFromData(data: SiteData): CriterionResult[];
339
+ /**
340
+ * Legacy entry point: fetches data and runs all checks.
341
+ * Used by analyzer.ts for the /api/aeo/analyze endpoint.
342
+ */
343
+ declare function auditSite(targetUrl: string): Promise<CriterionResult[]>;
331
344
 
332
345
  declare function calculateOverallScore(criteria: CriterionResult[]): number;
333
346
 
@@ -618,4 +631,4 @@ interface ComparisonResult {
618
631
  */
619
632
  declare function compare(domainA: string, domainB: string, options?: AuditOptions): Promise<ComparisonResult>;
620
633
 
621
- export { type AuditData, type AuditFinding, type AuditOptions, type AuditResult, 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 HeadlessOptions, 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 RenderingMethod, type ScoreCardItem, type SerializedLinkGraph, type Severity, type SiteData, type Status, type TopicCluster, analyzeAllPages, analyzePage, audit, auditSiteFromData, buildDetailedFindings, buildLinkGraph, buildScorecard, calculateDepths, calculateOverallScore, classifyRendering, compare, crawlFullSite, detectClusters, detectHubs, detectParkedDomain, detectPillars, extractAllUrlsFromSitemap, extractContentPagesFromSitemap, extractInternalLinks, extractLinksWithAnchors, extractNavLinks, extractRawDataSummary, fetchMultiPageData, fetchWithHeadless, generateBottomLine, generateComparisonHtmlReport, generateFixPlan, generateHtmlReport, generateOpportunities, generatePitchNumbers, generateVerdict, inferCategory, isSpaShell, prefetchSiteData, scoreAllPages, scorePage, scoreToStatus, serializeLinkGraph };
634
+ export { type AuditData, type AuditFinding, type AuditOptions, type AuditResult, 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 HeadlessOptions, 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 RenderingMethod, type ScoreCardItem, type SerializedLinkGraph, type Severity, type SiteData, type SitemapDateAnalysis, type Status, type TopicCluster, analyzeAllPages, analyzePage, audit, auditSite, auditSiteFromData, buildDetailedFindings, buildLinkGraph, buildScorecard, calculateDepths, calculateOverallScore, classifyRendering, compare, countRecentSitemapDates, crawlFullSite, detectClusters, detectHubs, detectParkedDomain, detectPillars, extractAllUrlsFromSitemap, extractContentPagesFromSitemap, extractInternalLinks, extractLinksWithAnchors, extractNavLinks, extractRawDataSummary, fetchMultiPageData, fetchWithHeadless, generateBottomLine, generateComparisonHtmlReport, generateFixPlan, generateHtmlReport, generateOpportunities, generatePitchNumbers, generateVerdict, inferCategory, isSpaShell, prefetchSiteData, scoreAllPages, scorePage, scoreToStatus, serializeLinkGraph };
package/dist/index.d.ts CHANGED
@@ -322,12 +322,25 @@ interface RawDataSummary {
322
322
  * Single entry point for all HTTP requests - no redundant fetches.
323
323
  */
324
324
  declare function prefetchSiteData(domain: string): Promise<SiteData>;
325
+ interface SitemapDateAnalysis {
326
+ recentCount: number;
327
+ isUniform: boolean;
328
+ uniformDetail?: string;
329
+ totalWithDates: number;
330
+ distinctRecentDays: number;
331
+ }
332
+ declare function countRecentSitemapDates(sitemapText: string): SitemapDateAnalysis;
325
333
  declare function extractRawDataSummary(data: SiteData): RawDataSummary;
326
334
  /**
327
335
  * Run all 26 criteria checks using pre-fetched site data.
328
336
  * All functions are synchronous (no HTTP calls) - data was already fetched.
329
337
  */
330
338
  declare function auditSiteFromData(data: SiteData): CriterionResult[];
339
+ /**
340
+ * Legacy entry point: fetches data and runs all checks.
341
+ * Used by analyzer.ts for the /api/aeo/analyze endpoint.
342
+ */
343
+ declare function auditSite(targetUrl: string): Promise<CriterionResult[]>;
331
344
 
332
345
  declare function calculateOverallScore(criteria: CriterionResult[]): number;
333
346
 
@@ -618,4 +631,4 @@ interface ComparisonResult {
618
631
  */
619
632
  declare function compare(domainA: string, domainB: string, options?: AuditOptions): Promise<ComparisonResult>;
620
633
 
621
- export { type AuditData, type AuditFinding, type AuditOptions, type AuditResult, 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 HeadlessOptions, 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 RenderingMethod, type ScoreCardItem, type SerializedLinkGraph, type Severity, type SiteData, type Status, type TopicCluster, analyzeAllPages, analyzePage, audit, auditSiteFromData, buildDetailedFindings, buildLinkGraph, buildScorecard, calculateDepths, calculateOverallScore, classifyRendering, compare, crawlFullSite, detectClusters, detectHubs, detectParkedDomain, detectPillars, extractAllUrlsFromSitemap, extractContentPagesFromSitemap, extractInternalLinks, extractLinksWithAnchors, extractNavLinks, extractRawDataSummary, fetchMultiPageData, fetchWithHeadless, generateBottomLine, generateComparisonHtmlReport, generateFixPlan, generateHtmlReport, generateOpportunities, generatePitchNumbers, generateVerdict, inferCategory, isSpaShell, prefetchSiteData, scoreAllPages, scorePage, scoreToStatus, serializeLinkGraph };
634
+ export { type AuditData, type AuditFinding, type AuditOptions, type AuditResult, 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 HeadlessOptions, 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 RenderingMethod, type ScoreCardItem, type SerializedLinkGraph, type Severity, type SiteData, type SitemapDateAnalysis, type Status, type TopicCluster, analyzeAllPages, analyzePage, audit, auditSite, auditSiteFromData, buildDetailedFindings, buildLinkGraph, buildScorecard, calculateDepths, calculateOverallScore, classifyRendering, compare, countRecentSitemapDates, crawlFullSite, detectClusters, detectHubs, detectParkedDomain, detectPillars, extractAllUrlsFromSitemap, extractContentPagesFromSitemap, extractInternalLinks, extractLinksWithAnchors, extractNavLinks, extractRawDataSummary, fetchMultiPageData, fetchWithHeadless, generateBottomLine, generateComparisonHtmlReport, generateFixPlan, generateHtmlReport, generateOpportunities, generatePitchNumbers, generateVerdict, inferCategory, isSpaShell, prefetchSiteData, scoreAllPages, scorePage, scoreToStatus, serializeLinkGraph };
package/dist/index.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 = {
@@ -5223,6 +5233,7 @@ export {
5223
5233
  analyzeAllPages,
5224
5234
  analyzePage,
5225
5235
  audit,
5236
+ auditSite,
5226
5237
  auditSiteFromData,
5227
5238
  buildDetailedFindings,
5228
5239
  buildLinkGraph,
@@ -5231,6 +5242,7 @@ export {
5231
5242
  calculateOverallScore,
5232
5243
  classifyRendering,
5233
5244
  compare,
5245
+ countRecentSitemapDates,
5234
5246
  crawlFullSite,
5235
5247
  detectClusters,
5236
5248
  detectHubs,