lintpage 0.3.2 → 0.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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![npm downloads](https://img.shields.io/npm/dm/lintpage.svg)](https://www.npmjs.com/package/lintpage)
5
5
  [![license](https://img.shields.io/npm/l/lintpage.svg)](https://github.com/lintpage/lintpage/blob/main/packages/cli/LICENSE)
6
6
 
7
- CLI tool that audits websites for SEO, accessibility, and performance issues. Catch noindex tag, broken meta tags, missing alt text, slow pages, and security problems before they hurt your rankings.
7
+ CLI tool that audits websites for SEO, accessibility, performance, and AI visibility issues. Catch noindex tags, broken meta tags, missing alt text, slow pages, security problems, and AI crawler blocks before they hurt your rankings and AI search visibility.
8
8
 
9
9
  ## Install
10
10
 
@@ -33,17 +33,16 @@ lintpage example.com
33
33
  ### Output
34
34
 
35
35
  ```
36
- LintPage audit for https://example.com
37
- Score: 85/100 Status: PASS
38
36
 
39
- Pre-Launch 28/30 (93%)
40
- SEO 32/35 (91%)
41
- Accessibility 18/20 (90%)
42
- Performance 14/15 (93%)
37
+ ✗ seo/title — Missing title tag
38
+ Add a <title> tag
43
39
 
44
- SEO
45
- ⚠ WARNING Title is too long (recommended: 50-60 characters)
46
- Shorten your title to under 60 characters.
40
+ ⚠ seo/meta-description — Meta description is too short
41
+ Expand your meta description
42
+
43
+ ℹ accessibility/html-lang — Missing lang attribute
44
+
45
+ DEPLOY BLOCKED · 1 critical · 1 warning · 1 info
47
46
  ```
48
47
 
49
48
  Exit codes:
@@ -54,15 +53,18 @@ Exit codes:
54
53
 
55
54
  ## Options
56
55
 
57
- | Flag | Description |
56
+ | Flag | Description |
58
57
  | ------------------- | ------------------------------------------------- |
59
58
  | `--format <format>` | Output format: `text` (default), `json`, `github` |
59
+ | `--config <path>` | Path to a config file |
60
60
  | `--fail-on-warning` | Exit 1 on warnings, not just criticals |
61
+ | `--ai-only` | Run only the AI Visibility module (LP-050–LP-060) |
62
+ | `--skip-ai` | Skip the AI Visibility module |
61
63
  | `--quiet` | Minimal output (counts only) |
62
64
 
63
65
  ## Rules
64
66
 
65
- LintPage checks **45+ rules** out of the box across five categories:
67
+ LintPage checks **60 rules** out of the box across five categories:
66
68
 
67
69
  ### Pre-Launch
68
70
 
@@ -133,18 +135,38 @@ LintPage checks **45+ rules** out of the box across five categories:
133
135
  | `performance` | INFO | Lazy loading, inline styles, and script count |
134
136
  | `image-dimensions` | INFO | Images have explicit width/height to prevent layout shift |
135
137
 
136
- ## Scoring
138
+ ### AI Visibility
139
+
140
+ Probes how AI assistants and crawlers (ChatGPT, Claude, Perplexity, Gemini) see your page — combining `robots.txt` directives with live per-bot fetches to catch silent edge blocks (e.g. Cloudflare's default AI-bot 403). Run these in isolation with `--ai-only`, or skip them with `--skip-ai`.
141
+
142
+ | Rule | Severity | What it checks |
143
+ | ------------------------------- | -------- | ------------------------------------------------------------------- |
144
+ | `ai/all-crawlers-blocked` | CRITICAL | Every tested AI bot is blocked — page is invisible to AI assistants |
145
+ | `ai/gptbot-silent-block` | CRITICAL | robots.txt allows GPTBot but the live fetch is blocked (403/429) |
146
+ | `ai/claudebot-silent-block` | CRITICAL | robots.txt allows ClaudeBot but the live fetch is blocked (403/429) |
147
+ | `ai/perplexitybot-silent-block` | CRITICAL | robots.txt allows PerplexityBot but the live fetch is blocked |
148
+ | `ai/chatgpt-user-blocked` | CRITICAL | ChatGPT-User (live retrieval) cannot reach the page |
149
+ | `ai/claude-user-blocked` | CRITICAL | Claude-User (live retrieval) cannot reach the page |
150
+ | `ai/perplexity-user-blocked` | CRITICAL | Perplexity-User (live retrieval) cannot reach the page |
151
+ | `ai/google-extended-disallowed` | WARNING | Google-Extended (Gemini) disallowed in robots.txt |
152
+ | `ai/applebot-extended-disallowed` | INFO | Applebot-Extended disallowed in robots.txt |
153
+ | `ai/empty-content-to-bot` | WARNING | Bot receives near-empty HTML (content needs JS to render) |
154
+ | `ai/llms-txt-missing` | INFO | No `llms.txt` file found |
155
+
156
+ ## Verdict
157
+
158
+ LintPage emits one of two verdicts after each scan:
159
+
160
+ - **READY TO SHIP** — no critical issues. Safe to deploy. Warnings and info findings remain for follow-up.
161
+ - **DEPLOY BLOCKED** — at least one critical issue. Fix before deploying. The CLI exits with code `1` so CI fails the build.
137
162
 
138
- Each page gets a score out of 100, weighted by category:
163
+ Issue severities:
139
164
 
140
- | Category | Weight |
141
- | ------------- | ------ |
142
- | Pre-Launch | 30 |
143
- | SEO | 35 |
144
- | Accessibility | 20 |
145
- | Performance | 15 |
165
+ - **CRITICAL** — production-breaking. e.g. `noindex` tag on prod, broken sitemap, broken SSL.
166
+ - **WARNING** — fix soon. e.g. missing meta description, oversized title, broken canonical.
167
+ - **INFO** — recommended. e.g. structured data missing, low content-to-HTML ratio.
146
168
 
147
- Severity deductions per issue: CRITICAL = −30%, WARNING = −5%, INFO = −1%.
169
+ Each rule has a stable identifier in the format `<category>/<ruleId>` (e.g. `seo/title`, `accessibility/image-alt-text`). The full registry of rules is at https://lintpage.com/checks.
148
170
 
149
171
  ## Configuration
150
172
 
package/dist/cli.cjs CHANGED
@@ -1,4 +1,5 @@
1
- const e=require(`./formatter-CJEdbkqw.cjs`);let t=require(`chalk`);t=e.a(t);let n=require(`cac`);n=e.a(n);let r=require(`dns/promises`);r=e.a(r);let i=require(`fs`),a=require(`path`);var o=[{meta:{id:`title`,name:`Page Title`,category:`SEO`,tier:`free`,description:`Checks for the presence and length of the <title> tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`title`)?.textContent?.trim()||``,i=r.length;return r?i<30?n.push({ruleId:`title`,ruleName:`Page Title`,message:`Title may be too short - under 30 characters may not be descriptive enough`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Expand your title to 50-60 characters to avoid truncation. Google does not enforce a character limit but truncates based on pixel width (~600px on desktop).`,data:{value:r,length:i}}):i>60&&n.push({ruleId:`title`,ruleName:`Page Title`,message:`Title is over 60 characters - likely to be truncated in search results`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Shorten your title to under 60 characters to avoid truncation. Google truncates based on pixel width (~600px on desktop), which is roughly 60 characters.`,data:{value:r,length:i}}):n.push({ruleId:`title`,ruleName:`Page Title`,message:`Missing title tag`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add a <title>Your Page Title</title> tag inside your <head> element. Aim for 50-60 characters to avoid truncation in search results.`,data:{value:r,length:i}}),n}},{meta:{id:`meta-description`,name:`Meta Description`,category:`SEO`,tier:`free`,description:`Checks for the presence and length of the meta description tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[name="description"]`)?.getAttribute(`content`)?.trim()||``,i=r.length;return r?i<120?n.push({ruleId:`meta-description`,ruleName:`Meta Description`,message:`Meta description may be too short - under 120 characters may not fully utilize the available snippet space`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Expand your meta description to 150-160 characters. Google does not enforce a character limit but typically truncates around 160 characters on desktop (~120 on mobile).`,data:{value:r,length:i}}):i>160&&n.push({ruleId:`meta-description`,ruleName:`Meta Description`,message:`Meta description is over 160 characters - likely to be truncated in search results`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Shorten your meta description to under 160 characters. Google truncates snippets based on device width, typically around 160 characters on desktop.`,data:{value:r,length:i}}):n.push({ruleId:`meta-description`,ruleName:`Meta Description`,message:`Missing meta description`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta name="description" content="Your description here" /> to your <head> tag. Aim for 150-160 characters to avoid truncation.`,data:{value:r,length:i}}),n}},{meta:{id:`og-title`,name:`Open Graph Title`,category:`SEO`,tier:`free`,description:`Checks for the og:title meta tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[property="og:title"]`)?.getAttribute(`content`)?.trim()||``;return r?r.length>60?n.push({ruleId:`og-title`,ruleName:`Open Graph Title`,message:`og:title is long (${r.length} characters). Optimal: 50-60 characters`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Shorten your og:title to under 60 characters. Longer titles get truncated on most social platforms.`,data:{value:r,length:r.length}}):r.length<30&&n.push({ruleId:`og-title`,ruleName:`Open Graph Title`,message:`og:title is short (${r.length} characters). Optimal: 50-60 characters`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Consider expanding your og:title to 50-60 characters to make social shares more compelling.`,data:{value:r,length:r.length}}):n.push({ruleId:`og-title`,ruleName:`Open Graph Title`,message:`Missing og:title tag - social media shares will have no title preview`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta property="og:title" content="Your Page Title" /> to your <head> tag.`}),n}},{meta:{id:`og-description`,name:`Open Graph Description`,category:`SEO`,tier:`free`,description:`Checks for the og:description meta tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[property="og:description"]`)?.getAttribute(`content`)?.trim()||``;return r?r.length>200?n.push({ruleId:`og-description`,ruleName:`Open Graph Description`,message:`og:description is long (${r.length} characters). Optimal: 110-160 characters`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Shorten your og:description to under 200 characters. Most platforms truncate longer descriptions.`,data:{value:r,length:r.length}}):r.length<70&&n.push({ruleId:`og-description`,ruleName:`Open Graph Description`,message:`og:description is short (${r.length} characters). Optimal: 110-160 characters`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Consider expanding your og:description to 110-160 characters to make social shares more engaging.`,data:{value:r,length:r.length}}):n.push({ruleId:`og-description`,ruleName:`Open Graph Description`,message:`Missing og:description tag - social media shares will have no description preview`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta property="og:description" content="Your description" /> to your <head> tag.`}),n}},{meta:{id:`og-image`,name:`Open Graph Image`,category:`SEO`,tier:`free`,description:`Checks for the og:image meta tag`},run(e){let{document:t}=e,n=[];return t.querySelector(`meta[property="og:image"]`)?.getAttribute(`content`)||n.push({ruleId:`og-image`,ruleName:`Open Graph Image`,message:`Missing og:image tag - social media shares will have no image preview`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta property="og:image" content="https://yoursite.com/image.jpg" /> to your <head> tag.`}),n}},{meta:{id:`og-url`,name:`Open Graph URL`,category:`SEO`,tier:`free`,description:`Checks for the og:url meta tag`},run(e){let{document:t}=e,n=[];return t.querySelector(`meta[property="og:url"]`)?.getAttribute(`content`)||n.push({ruleId:`og-url`,ruleName:`Open Graph URL`,message:`Missing og:url tag - social media may not show the correct URL`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta property="og:url" content="https://yoursite.com/page" /> to your <head> tag.`}),n}},{meta:{id:`twitter-card`,name:`Twitter Card`,category:`SEO`,tier:`free`,description:`Checks for Twitter Card meta tags`},run(e){let{document:t}=e,n=[];return t.querySelector(`meta[name="twitter:card"]`)?.getAttribute(`content`)||n.push({ruleId:`twitter-card`,ruleName:`Twitter Card`,message:`Missing Twitter Card tags - tweets with your URL will have no preview card`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta name="twitter:card" content="summary_large_image" />, <meta name="twitter:title" content="..." />, and <meta name="twitter:image" content="..." /> to your <head>.`}),n}},{meta:{id:`canonical-url`,name:`Canonical URL`,category:`SEO`,tier:`free`,description:`Checks for a canonical link tag and validates the URL`},run(e){let{document:t}=e,n=[],r=t.querySelector(`link[rel="canonical"]`),i=r?.getAttribute(`href`)||void 0;return r?i&&!i.startsWith(`http`)&&n.push({ruleId:`canonical-url`,ruleName:`Canonical URL`,message:`Canonical URL should be absolute (include protocol and domain)`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Change your canonical href to an absolute URL starting with https:// (e.g., href="https://yoursite.com/page").`,data:{present:!0,value:i}}):n.push({ruleId:`canonical-url`,ruleName:`Canonical URL`,message:`No canonical link found (recommended for SEO)`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Add <link rel="canonical" href="https://yoursite.com/this-page" /> to your <head> tag to prevent duplicate content issues.`,data:{present:!1}}),n}},{meta:{id:`robots-noindex`,name:`Robots Noindex`,category:`Pre-Launch`,tier:`free`,description:`Checks for noindex/nofollow in the robots meta tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[name="robots"]`)?.getAttribute(`content`)||``;return r.includes(`noindex`)&&n.push({ruleId:`robots-noindex`,ruleName:`Robots Noindex`,message:`Page has noindex meta tag - WILL NOT BE INDEXED by search engines! Remove this before launch or you'll get ZERO organic traffic.`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`free`,fix:`Remove the <meta name="robots" content="noindex" /> tag from your <head>, or change it to content="index, follow".`,data:{metaRobots:r}}),r.includes(`nofollow`)&&n.push({ruleId:`robots-noindex`,ruleName:`Robots Noindex`,message:`Page has nofollow meta tag - links will not be followed`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Remove "nofollow" from your <meta name="robots"> content if you want search engines to follow your links.`,data:{metaRobots:r}}),n}},{meta:{id:`heading-structure`,name:`Heading Structure`,category:`SEO`,tier:`free`,description:`Validates H1 tag presence, count, and heading hierarchy`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`h1`),i=r.length,a=Array.from(r).map(e=>e.textContent?.trim()||``);i===0?n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`No H1 tag found`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add a single <h1> tag to your page with a clear, descriptive heading that includes your primary keyword.`,data:{h1Count:i}}):i>1&&n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`Multiple H1 tags found (${i}). Best practice is 1 per page`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`While Google does not penalize multiple H1 tags, using a single H1 per page is a widely recommended best practice for clarity and accessibility.`,data:{h1Count:i,h1Values:a}}),a.forEach((e,t)=>{e?e.length>70&&n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`H1 #${t+1} is too long (${e.length} characters)`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Shorten your H1 to under 70 characters for better readability and SEO.`}):n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`H1 #${t+1} is empty`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add descriptive text content to your <h1> tag.`})});let o=t.querySelectorAll(`h1, h2, h3, h4, h5, h6`),s=0;return Array.from(o).forEach(e=>{let t=Number.parseInt(e.tagName[1]??`1`,10);if(t-s>1){let t=e.textContent?.trim().substring(0,40)||`...`;n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`${e.tagName} skips heading level from h${s} (content: "${t}")`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Don't skip heading levels. Use h${s+1} instead of ${e.tagName} to maintain proper hierarchy.`})}s=t}),n}},{meta:{id:`html-lang`,name:`HTML Lang Attribute`,category:`Accessibility`,tier:`free`,description:`Checks for the lang attribute on the <html> tag`},run(e){let{document:t}=e,n=[];return t.documentElement.getAttribute(`lang`)||n.push({ruleId:`html-lang`,ruleName:`HTML Lang Attribute`,message:`Missing lang attribute on <html> tag`,severity:`WARNING`,category:`Accessibility`,tier:`free`,fix:`Add lang="en" (or your language code) to your <html> tag: <html lang="en">.`,data:{present:!1}}),n}},{meta:{id:`viewport`,name:`Viewport Meta Tag`,category:`SEO`,tier:`free`,description:`Checks for the viewport meta tag for mobile responsiveness`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[name="viewport"]`);if(!r)n.push({ruleId:`viewport`,ruleName:`Viewport Meta Tag`,message:`Missing viewport meta tag - page will not render properly on mobile devices`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta name="viewport" content="width=device-width, initial-scale=1" /> to your <head> tag.`,data:{present:!1}});else{let e=r.getAttribute(`content`)||``,t=/user-scalable\s*=\s*no/i.test(e),i=e.match(/maximum-scale\s*=\s*([\d.]+)/i),a=i&&parseFloat(i[1])<2;(t||a)&&n.push({ruleId:`viewport`,ruleName:`Viewport Meta Tag`,message:`Viewport disables or restricts user zoom - this fails WCAG 1.4.4 (Resize text) which requires at least 200% zoom`,severity:`WARNING`,category:`Accessibility`,tier:`free`,fix:`Remove user-scalable=no and ensure maximum-scale is at least 2.0 (or remove it entirely) to allow users to zoom.`})}return n}},{meta:{id:`favicon`,name:`Favicon`,category:`SEO`,tier:`free`,description:`Checks for the presence of a favicon link tag`},run(e){let{document:t}=e,n=[];return t.querySelector(`link[rel*="icon"]`)||n.push({ruleId:`favicon`,ruleName:`Favicon`,message:`No favicon found - browsers will show a default icon in tabs and bookmarks`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <link rel="icon" href="/favicon.ico" /> to your <head> tag. Include multiple sizes for best results.`,data:{present:!1}}),n}},{meta:{id:`anchor-missing-href`,name:`Anchor Missing Href`,category:`SEO`,tier:`free`,description:`Checks that all <a> elements have a valid href attribute`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`a`),i=[];for(let e of r){let t=e.getAttribute(`href`);if(!t||t.trim()===``){let t=e.textContent?.trim()||``,n=t.length>50?t.slice(0,50)+`…`:t;i.push(n||`<empty>`)}}return i.length>0&&n.push({ruleId:`anchor-missing-href`,ruleName:`Anchor Missing Href`,message:`${i.length} <a> element(s) missing a valid href attribute: ${i.join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add a valid href attribute to all <a> elements. Links without href are not crawlable by search engines and inaccessible to keyboard/screen reader users. If the element is not a link, use a <button> or <span> instead.`,data:{count:i.length,anchors:i}}),n}}];new Map(o.map(e=>[e.meta.id,e]));function s(e){let t=e.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);if(!t)return!1;let[,n,r]=t.map(Number);return n===10||n===172&&r>=16&&r<=31||n===192&&r===168||n===127||n===169&&r===254||n===0||n===100&&r>=64&&r<=127||n===198&&(r===18||r===19)||n>=224}function c(e){return!!(e===`localhost`||e===`127.0.0.1`||e===`[::1]`||e===`0.0.0.0`||e.endsWith(`.internal`)||e.endsWith(`.local`)||e.endsWith(`.localhost`)||s(e)||e.startsWith(`[`)&&(e===`[::1]`||e.startsWith(`[fc`)||e.startsWith(`[fd`)||e.startsWith(`[fe80:`)))}async function l(e){let t=e.replace(/^\[|\]$/g,``);try{let{address:e}=await r.default.lookup(t);if(s(e))throw Error(`URLs pointing to private or internal addresses are not allowed`)}catch(e){throw e instanceof Error&&e.message.includes(`private or internal`)?e:Error(`Could not resolve hostname`)}}function u(e){let t;try{t=new URL(e)}catch{throw Error(`Invalid URL`)}if(t.protocol!==`http:`&&t.protocol!==`https:`)throw Error(`Only HTTP and HTTPS URLs are allowed`);if(c(t.hostname))throw Error(`URLs pointing to private or internal addresses are not allowed`)}async function d(e){u(e),await l(new URL(e).hostname)}async function f(e){await d(e);let t=Date.now(),n=await fetch(e,{headers:{"User-Agent":`LintPage-Bot/1.0`},signal:AbortSignal.timeout(3e4)}),r=Date.now()-t;if(!n.ok)throw Error(`Failed to fetch URL: ${n.status} ${n.statusText}`);let i=await n.text(),{JSDOM:a}=await import(`jsdom`);return{document:new a(i).window.document,response:n,html:i,ttfbMs:r}}var p={"Pre-Launch":30,SEO:35,Accessibility:20,Performance:15};function m(e){let t={};for(let e of Object.keys(p))t[e]={critical:0,warning:0,info:0};for(let n of e){let e=n.category;t[e]||(t[e]={critical:0,warning:0,info:0}),n.severity===`CRITICAL`?t[e].critical++:n.severity===`WARNING`?t[e].warning++:t[e].info++}let n={};for(let[e,r]of Object.entries(p)){let i=t[e]||{critical:0,warning:0,info:0},a=Math.min(100,i.critical*30+i.warning*5+i.info*1);n[e]={score:Math.round(r*(1-a/100)*10)/10,max:r,deductionPercent:a}}return n}function ee(e,t,n){let r=[];for(let i of e){if(n?.rules){let e=n.rules[i.meta.id];if(e===!1||typeof e==`object`&&e.enabled===!1)continue}try{let e=i.run(t);r.push(...e)}catch(e){console.warn(`[lintpage] Rule "${i.meta.id}" threw an error: ${e instanceof Error?e.message:String(e)}`)}}return r}function h(e,t){if(!t?.rules)return!0;let n=t.rules[e];return!(n===!1||typeof n==`object`&&n.enabled===!1)}async function te(e,t,n){let r=e.filter(e=>h(e.meta.id,n)),i=await Promise.allSettled(r.map(e=>e.run(t))),a=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.status===`fulfilled`)a.push(...t.value);else{let n=t.reason;console.warn(`[lintpage] Async rule "${r[e].meta.id}" threw an error: ${n instanceof Error?n.message:String(n)}`)}}return a}async function ne(e,t,n){let r=e.filter(e=>h(e.meta.id,n)),i=await Promise.allSettled(r.map(e=>e.run(t))),a=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.status===`fulfilled`)a.push(...t.value);else{let n=t.reason;console.warn(`[lintpage] Standalone rule "${r[e].meta.id}" threw an error: ${n instanceof Error?n.message:String(n)}`)}}return a}async function g(e,t){let{document:n,response:r,ttfbMs:i}=await f(e),a={document:n,url:e,response:r,isHttps:e.startsWith(`https://`)},s=[...o],c=[],l=[];if(t?.plugins)for(let e of t.plugins)s.push(...e.rules),e.asyncRules&&c.push(...e.asyncRules),e.standaloneRules&&l.push(...e.standaloneRules);let u=ee(s,a,t?.config),d=[];if(c.length>0&&d.push(te(c,a,t?.config)),l.length>0&&d.push(ne(l,e,t?.config)),d.length>0){let e=await Promise.all(d);for(let t of e)u.push(...t)}i>1800?u.push({ruleId:`ttfb`,ruleName:`Time to First Byte`,message:`Slow server response time (TTFB: ${i}ms) - aim for under 800ms`,severity:`WARNING`,category:`Performance`,tier:`free`,fix:`Optimize server response time: enable caching, use a CDN, optimize database queries, or upgrade hosting.`,data:{ms:i}}):i>800&&u.push({ruleId:`ttfb`,ruleName:`Time to First Byte`,message:`Server response time could be improved (TTFB: ${i}ms) - aim for under 800ms`,severity:`INFO`,category:`Performance`,tier:`free`,fix:`Consider enabling server-side caching or using a CDN to reduce response time.`,data:{ms:i}});let p=m(u),h=Object.values(p).reduce((e,t)=>e+t.score,0),g=u.some(e=>e.severity===`CRITICAL`);return{url:e,timestamp:new Date().toISOString(),results:u,score:Math.round(h),overallStatus:g?`FAIL`:`PASS`,categoryScores:p}}var re=[`.lintpagerc.json`,`.lintpagerc`,`lintpage.config.json`];function ie(e){let t=e||process.cwd();if(e&&(0,i.existsSync)(e)&&(0,i.statSync)(e).isFile())try{let t=(0,i.readFileSync)(e,`utf-8`);return JSON.parse(t)}catch{return null}let n=t;for(let e of re){let t=(0,a.join)(n,e);if((0,i.existsSync)(t))try{let e=(0,i.readFileSync)(t,`utf-8`);return JSON.parse(e)}catch{return null}}return null}function _(){return{rules:{}}}var v={meta:{id:`ssl`,name:`SSL / HTTPS`,category:`Pre-Launch`,tier:`pro`,description:`Checks that the site is served over HTTPS`},run(e){let t=[];return e.isHttps||t.push({ruleId:`ssl`,ruleName:`SSL / HTTPS`,message:`Site is not using HTTPS - required for SEO and user trust. Search engines penalize HTTP sites.`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Install an SSL certificate and redirect all HTTP traffic to HTTPS. Most hosting providers offer free SSL via Let's Encrypt.`}),t}},y={meta:{id:`robots-txt-check`,name:`robots.txt Check`,category:`Pre-Launch`,tier:`pro`,description:`Fetches and validates robots.txt for proper directives`},async run(e){let t=[];try{let n=new URL(`/robots.txt`,e).href,r=await fetch(n,{headers:{"User-Agent":`LintPage-Bot/1.0`}});if(!r.ok)return t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`No robots.txt file found - recommended to have one`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Create a robots.txt file at your site root with at least "User-Agent: *" and "Allow: /" directives.`}),t;let i=await r.text(),a=i.split(`
2
- `).map(e=>e.trim()),o=new Map,s=`*`;for(let e of a){if(!e||e.startsWith(`#`))continue;let[t,...n]=e.split(`:`).map(e=>e.trim()),r=n.join(`:`).trim();if(!t||!r)continue;let i=t.toUpperCase();if(i===`USER-AGENT`)s=r,o.has(s)||o.set(s,{disallow:[],allow:[]});else if(i===`DISALLOW`){let e=o.get(s)||{disallow:[],allow:[]};e.disallow.push(r),o.set(s,e)}else if(i===`ALLOW`){let e=o.get(s)||{disallow:[],allow:[]};e.allow.push(r),o.set(s,e)}}let c=o.get(`*`);c&&c.disallow.includes(`/`)&&t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`robots.txt contains "Disallow: /" for User-Agent: * - this blocks ALL search engines from crawling your entire site!`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Change "Disallow: /" to "Allow: /" in your robots.txt, or remove the Disallow directive entirely.`}),i.toLowerCase().includes(`sitemap`)||t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`robots.txt does not reference sitemap.xml - consider adding a Sitemap directive`,severity:`INFO`,category:`Pre-Launch`,tier:`pro`,fix:`Add "Sitemap: https://yoursite.com/sitemap.xml" to the end of your robots.txt file.`}),a.some(e=>!e||e.startsWith(`#`)?!1:!e.includes(`:`)&&e.length>0)&&t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`robots.txt may have syntax errors - ensure each directive follows "Directive: value" format`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Review each line in robots.txt. Every directive must follow the "Directive: value" format (e.g., "User-Agent: *").`}),(o.size===0||o.size===1&&!o.has(`*`))&&t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`robots.txt exists but has no rules defined - add User-Agent and Disallow/Allow directives`,severity:`INFO`,category:`Pre-Launch`,tier:`pro`,fix:`Add at minimum "User-Agent: *" followed by "Allow: /" to your robots.txt.`})}catch{t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`Could not fetch robots.txt - ensure it exists at root domain`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Create a robots.txt file at your domain root (e.g., https://yoursite.com/robots.txt).`})}return t}},b={meta:{id:`sitemap-presence`,name:`Sitemap Presence`,category:`Pre-Launch`,tier:`pro`,description:`Checks for the existence and validity of sitemap.xml`},async run(e){let t=[];try{let n=new URL(`/sitemap.xml`,e).href,r=await fetch(n,{headers:{"User-Agent":`LintPage-Bot/1.0`}});if(!r.ok)return t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`No sitemap.xml found - recommended for search engines to discover your pages`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Generate a sitemap.xml and place it at your domain root. Most frameworks (Next.js, WordPress) have built-in sitemap generation.`}),t;let i=await r.text(),a=i.includes(`<urlset`),o=i.includes(`<sitemapindex`);if((!i.includes(`<?xml`)||!a&&!o)&&t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`sitemap.xml exists but may not be valid XML format`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Ensure your sitemap.xml starts with <?xml version="1.0"?> and uses the <urlset> or <sitemapindex> element with proper namespace.`}),o){let e=i.match(/<sitemap>/g);return(!e||e.length===0)&&t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`Sitemap index file is empty - add child sitemap references`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Add <sitemap><loc>https://yoursite.com/sitemap-pages.xml</loc></sitemap> entries to your sitemap index.`}),t}let s=i.match(/<loc>/g);(s?s.length:0)===0&&t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`sitemap.xml is empty - add URLs to help search engines discover content`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Add <url><loc>https://yoursite.com/page</loc></url> entries to your sitemap for each page you want indexed.`})}catch{t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`Could not fetch sitemap.xml - create one at /sitemap.xml`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Create a sitemap.xml at your domain root. Use a sitemap generator or your framework's built-in sitemap feature.`})}return t}},x={meta:{id:`tracking`,name:`Analytics Tracking`,category:`Pre-Launch`,tier:`pro`,description:`Checks for Google Analytics, Google Tag Manager, or Facebook Pixel`},run(e){let{document:t}=e,n=[],r=!1,i=t.querySelectorAll(`script`),a=t.documentElement?.outerHTML||``;return i.forEach(e=>{let t=e.getAttribute(`src`)||``,n=e.textContent||``;(t.includes(`googletagmanager.com/gtag/js`)||n.includes(`gtag(`))&&(r=!0),(t.includes(`googletagmanager.com/gtm.js`)||n.includes(`GTM-`))&&(r=!0),t.includes(`plausible.io/js/`)&&(r=!0),(t.includes(`usefathom.com/script.js`)||t.includes(`cdn.usefathom.com`))&&(r=!0),(t.includes(`matomo.js`)||t.includes(`matomo.php`)||t.includes(`piwik.js`))&&(r=!0),(t.includes(`posthog-js`)||t.includes(`i.posthog.com`))&&(r=!0),(t.includes(`cdn.mxpnl.com`)||t.includes(`mixpanel.com`))&&(r=!0),(t.includes(`va.vercel-scripts.com`)||t.includes(`vitals.vercel-insights.com`))&&(r=!0),t.includes(`static.cloudflareinsights.com`)&&(r=!0),(t.includes(`umami.js`)||t.includes(`umami.is/script.js`))&&(r=!0),t.includes(`clarity.ms/tag`)&&(r=!0)}),!r&&(a.includes(`@vercel/analytics`)||a.includes(`vercel-analytics`))&&(r=!0),r||n.push({ruleId:`tracking`,ruleName:`Analytics Tracking`,message:`No analytics tracking found - you won't be able to measure traffic after launch`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Add an analytics solution to your site. Options include Google Analytics, Plausible, Fathom, Matomo, PostHog, Vercel Analytics, Umami, or Cloudflare Web Analytics.`,data:{foundAnalytics:r}}),n}},S={meta:{id:`x-robots-tag`,name:`X-Robots-Tag Header`,category:`Pre-Launch`,tier:`pro`,description:`Checks the X-Robots-Tag HTTP header for noindex/nofollow`},run(e){let{response:t}=e,n=[],r=t.headers.get(`x-robots-tag`);if(!r)return n;let i=r.toLowerCase();return i.includes(`noindex`)&&n.push({ruleId:`x-robots-tag`,ruleName:`X-Robots-Tag Header`,message:`X-Robots-Tag HTTP header contains "noindex" - page will NOT be indexed by search engines!`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Remove the X-Robots-Tag header from your server configuration, or change its value to "index, follow".`,data:{value:r}}),i.includes(`nofollow`)&&n.push({ruleId:`x-robots-tag`,ruleName:`X-Robots-Tag Header`,message:`X-Robots-Tag HTTP header contains "nofollow" - links will not be followed by search engines`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove "nofollow" from the X-Robots-Tag header if you want search engines to follow your links.`,data:{value:r}}),n}},C={meta:{id:`thin-content`,name:`Thin Content`,category:`SEO`,tier:`pro`,description:`Checks that the page has sufficient text content for search engines`},run(e){let{document:t}=e,n=[],r=(t.body?.textContent||``).trim().split(/\s+/).filter(Boolean).length;return r<300&&n.push({ruleId:`thin-content`,ruleName:`Thin Content`,message:`Page has thin content (${r} words) - search engines prefer pages with substantial content (300+ words)`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add more meaningful text content to the page. Search engines rank pages with substantial, relevant content higher.`,data:{wordCount:r}}),n}},w={meta:{id:`duplicate-meta`,name:`Duplicate Meta Tags`,category:`SEO`,tier:`pro`,description:`Checks for duplicate title, meta description, and canonical tags`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`title`);r.length>1&&n.push({ruleId:`duplicate-meta`,ruleName:`Duplicate Meta Tags`,message:`Found ${r.length} <title> tags - should have exactly one`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove duplicate <title> tags. Keep only one in your <head> element.`,data:{count:r.length,tag:`title`}});let i=t.querySelectorAll(`meta[name="description"]`);i.length>1&&n.push({ruleId:`duplicate-meta`,ruleName:`Duplicate Meta Tags`,message:`Found ${i.length} meta description tags - should have exactly one`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove duplicate <meta name="description"> tags. Keep only one in your <head> element.`,data:{count:i.length,tag:`meta-description`}});let a=t.querySelectorAll(`link[rel="canonical"]`);return a.length>1&&n.push({ruleId:`duplicate-meta`,ruleName:`Duplicate Meta Tags`,message:`Found ${a.length} canonical link tags - should have exactly one`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove duplicate <link rel="canonical"> tags. Keep only one in your <head> element.`,data:{count:a.length,tag:`canonical`}}),n}},T={meta:{id:`structured-data`,name:`Structured Data`,category:`SEO`,tier:`pro`,description:`Checks for the presence and validity of JSON-LD structured data`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`script[type="application/ld+json"]`),i=[];return r.forEach(e=>{try{let t=JSON.parse(e.textContent||``);if(Array.isArray(t[`@graph`]))for(let e of t[`@graph`])e[`@type`]&&i.push(e[`@type`]);else t[`@type`]&&i.push(t[`@type`])}catch{n.push({ruleId:`structured-data`,ruleName:`Structured Data`,message:`Invalid JSON-LD structured data found`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Validate your JSON-LD using Google's Rich Results Test tool and fix any JSON syntax errors.`})}}),i.length===0&&n.push({ruleId:`structured-data`,ruleName:`Structured Data`,message:`No structured data (JSON-LD) found`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add a <script type="application/ld+json"> block with Organization, WebPage, or other relevant schema.org types.`,data:{types:i}}),n}},E={meta:{id:`charset`,name:`Character Encoding`,category:`SEO`,tier:`pro`,description:`Checks for a proper charset/encoding declaration`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[charset]`),i=t.querySelector(`meta[http-equiv="Content-Type"]`);return!r&&!i&&n.push({ruleId:`charset`,ruleName:`Character Encoding`,message:`Missing character encoding declaration - may cause rendering issues with special characters`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <meta charset="utf-8" /> as the first element in your <head> tag.`}),n}},D={meta:{id:`image-alt-text`,name:`Image Alt Text`,category:`Accessibility`,tier:`pro`,description:`Checks that all images have alt attributes`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`img`),i=0;return r.forEach(e=>{e.getAttribute(`alt`)??i++}),i>0&&n.push({ruleId:`image-alt-text`,ruleName:`Image Alt Text`,message:`${i} of ${r.length} images missing alt attributes`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Add descriptive alt attributes to all images. Screen readers use alt text to describe images to visually impaired users. Use alt="" for decorative images.`,data:{total:r.length,missingAlt:i}}),n}},O={meta:{id:`accessibility`,name:`Accessibility & ARIA`,category:`Accessibility`,tier:`pro`,description:`Checks buttons, links, inputs, and ARIA attributes for accessibility`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`button`),i=0;r.forEach(e=>{let t=e.textContent?.trim(),n=e.getAttribute(`aria-label`),r=e.getAttribute(`aria-labelledby`);!t&&!n&&!r&&i++}),i>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${i} button(s) missing accessible name (no text, aria-label, or aria-labelledby)`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Add visible text content, an aria-label, or aria-labelledby attribute to each button.`,data:{inaccessibleButtons:i}});let a=t.querySelectorAll(`a`),o=0;a.forEach(e=>{let t=e.textContent?.trim(),n=e.getAttribute(`aria-label`),r=e.getAttribute(`aria-labelledby`);!t&&!n&&!r&&o++}),o>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${o} link(s) missing accessible name (no text, aria-label, or aria-labelledby)`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Add descriptive text content, an aria-label, or aria-labelledby attribute to each link so screen readers can identify it.`,data:{inaccessibleLinks:o}});let s=t.querySelectorAll(`input:not([type='hidden'])`),c=0;s.forEach(e=>{let n=e.getAttribute(`id`),r=e.getAttribute(`aria-label`),i=e.getAttribute(`aria-labelledby`),a=e.getAttribute(`title`),o=n&&t.querySelector(`label[for="${n}"]`),s=e.closest(`label`)!==null;!o&&!s&&!r&&!i&&!a&&c++}),c>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${c} input(s) missing associated label`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Add a <label for="inputId"> element, or add an aria-label attribute to each input.`,data:{unlabeledInputs:c}});let l=t.querySelectorAll(`div[onclick], span[onclick]`),u=0;l.forEach(e=>{e.getAttribute(`role`)||u++}),u>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${u} interactive div/span element(s) missing role attribute`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Use a <button> element instead, or add role="button" and an aria-label to interactive elements.`,data:{missingRoles:u}});let d=t.querySelectorAll(`nav, [role="navigation"]`),f=0;return d.forEach(e=>{let t=e.getAttribute(`aria-label`),n=e.getAttribute(`aria-labelledby`);!t&&!n&&f++}),f>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${f} navigation element(s) missing aria-label or aria-labelledby`,severity:`INFO`,category:`Accessibility`,tier:`pro`,fix:`Add aria-label="Main navigation" (or similar descriptive label) to your <nav> elements.`,data:{unlabeledNav:f}}),n}},k={meta:{id:`semantic-structure`,name:`Semantic Structure`,category:`Accessibility`,tier:`pro`,description:`Checks for proper semantic HTML: landmarks, lists, tables, articles`},run(e){let{document:t}=e,n=[];t.querySelector(`main`)||n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`Missing <main> element - should wrap primary page content for better structure`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Wrap your primary page content in a <main> element. There should be exactly one per page.`}),t.querySelectorAll(`main, section, article, aside, nav`).length===0&&n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`Missing semantic page regions - use <main>, <section>, <article>, <nav>, <aside> instead of generic divs`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Replace generic <div> containers with semantic elements: <main>, <nav>, <section>, <article>, <aside>.`});let r=t.querySelectorAll(`li`),i=0;r.forEach(e=>{let t=e.parentElement;t?.tagName!==`UL`&&t?.tagName!==`OL`&&i++}),i>0&&n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`${i} <li> element(s) found outside of <ul> or <ol> - breaks semantic structure`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Wrap <li> elements inside a <ul> (unordered) or <ol> (ordered) list element.`,data:{orphanedLi:i}});let a=t.querySelectorAll(`table`),o=0;a.forEach(e=>{e.querySelector(`th`)||o++}),o>0&&n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`${o} table(s) missing <th> header cells`,severity:`INFO`,category:`Accessibility`,tier:`pro`,fix:`Add <th> cells to define table column or row headers. Optionally wrap them in a <thead> element for additional structure.`,data:{tablesWithoutHeaders:o}});let s=t.querySelectorAll(`article`),c=0;return s.forEach(e=>{e.querySelector(`h1, h2, h3, h4, h5, h6`)||c++}),c>0&&n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`${c} <article> element(s) without a heading`,severity:`INFO`,category:`Accessibility`,tier:`pro`,fix:`Add a heading (h2-h6) inside each <article> element to provide context.`,data:{articlesWithoutHeading:c}}),n}},A={meta:{id:`performance`,name:`Performance Hints`,category:`Performance`,tier:`pro`,description:`Checks for inline styles, lazy loading, and script count`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`img`),i=Array.from(r).slice(3),a=0;i.forEach(e=>{e.getAttribute(`loading`)||a++}),a>0&&n.push({ruleId:`performance`,ruleName:`Performance Hints`,message:`${a} below-the-fold image(s) without loading="lazy" - add lazy loading to defer offscreen images`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Add loading="lazy" to images below the fold. Do NOT add loading="lazy" to above-the-fold or LCP images - this hurts performance (per web.dev).`,data:{noLazyLoad:a,totalImages:r.length}});let o=t.querySelectorAll(`script[src]`);return o.length>10&&n.push({ruleId:`performance`,ruleName:`Performance Hints`,message:`Consider reducing external scripts (${o.length} found) for better performance`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Audit your scripts and remove unused ones. Consider bundling or deferring non-critical scripts.`,data:{scriptCount:o.length}}),n}},j={meta:{id:`image-dimensions`,name:`Image Dimensions`,category:`Performance`,tier:`pro`,description:`Checks that images have explicit width and height to prevent layout shift (CLS)`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`img`),i=0;return r.forEach(e=>{let t=e.getAttribute(`width`),n=e.getAttribute(`height`);(!t||!n)&&i++}),i>0&&n.push({ruleId:`image-dimensions`,ruleName:`Image Dimensions`,message:`${i} image${i===1?``:`s`} missing explicit width/height attributes - causes layout shift (CLS)`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Add width and height attributes to <img> tags to reserve space and prevent layout shift.`,data:{missingCount:i,totalImages:r.length}}),n}},M={meta:{id:`ttfb-pro`,name:`Time to First Byte (Pro)`,category:`Performance`,tier:`pro`,description:`Measures server response time (TTFB) with detailed thresholds`},async run(e){let t=[];try{let n=Date.now();await fetch(e,{headers:{"User-Agent":`LintPage-Bot/1.0`}});let r=Date.now()-n;r>1800?t.push({ruleId:`ttfb-pro`,ruleName:`Time to First Byte (Pro)`,message:`Slow server response time (TTFB: ${r}ms) - aim for under 800ms`,severity:`WARNING`,category:`Performance`,tier:`pro`,fix:`Optimize server response time: enable caching, use a CDN, optimize database queries, or upgrade hosting.`,data:{ms:r}}):r>800&&t.push({ruleId:`ttfb-pro`,ruleName:`Time to First Byte (Pro)`,message:`Server response time could be improved (TTFB: ${r}ms) - aim for under 800ms`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Consider enabling server-side caching or using a CDN to reduce response time.`,data:{ms:r}})}catch{t.push({ruleId:`ttfb-pro`,ruleName:`Time to First Byte (Pro)`,message:`Could not measure TTFB - server may be unreachable`,severity:`WARNING`,category:`Performance`,tier:`pro`,fix:`Ensure your server is accessible and responding to requests.`})}return t}},N={meta:{id:`mixed-content`,name:`Mixed Content`,category:`Pre-Launch`,tier:`pro`,description:`Checks for HTTP resources loaded on an HTTPS page (mixed content)`},run(e){let{document:t,isHttps:n}=e,r=[];if(!n)return r;let i=[`img[src^="http:"]`,`script[src^="http:"]`,`link[href^="http:"]`,`iframe[src^="http:"]`,`video[src^="http:"]`,`audio[src^="http:"]`,`object[data^="http:"]`,`source[src^="http:"]`],a=0;return i.forEach(e=>{a+=t.querySelectorAll(e).length}),a>0&&r.push({ruleId:`mixed-content`,ruleName:`Mixed Content`,message:`Found ${a} mixed content resource${a===1?``:`s`} (HTTP on HTTPS page) - browsers may block these`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Change all resource URLs from http:// to https:// or use protocol-relative URLs (//).`,data:{count:a}}),r}},P={meta:{id:`security-headers`,name:`Security Headers`,category:`Pre-Launch`,tier:`pro`,description:`Checks for important security headers (CSP, HSTS, X-Content-Type-Options, Permissions-Policy)`},run(e){let{response:t}=e,n=[],r=[{name:`content-security-policy`,label:`Content-Security-Policy`},{name:`strict-transport-security`,label:`Strict-Transport-Security (HSTS)`},{name:`x-content-type-options`,label:`X-Content-Type-Options`},{name:`permissions-policy`,label:`Permissions-Policy`}],i=[];return r.forEach(({name:e,label:n})=>{t.headers.get(e)||i.push(n)}),i.length>0&&n.push({ruleId:`security-headers`,ruleName:`Security Headers`,message:`Missing security headers: ${i.join(`, `)}`,severity:`INFO`,category:`Pre-Launch`,tier:`pro`,fix:`Configure your server or hosting provider to send these security headers. Most can be set in next.config.js headers() or your CDN settings.`,data:{missing:i}}),n}},F={meta:{id:`og-image-size`,name:`OG Image Size`,category:`SEO`,tier:`pro`,description:`Checks that the og:image URL exists and advises on recommended dimensions (1200x630)`},run(e){let{document:t}=e,n=[];if(!t.querySelector(`meta[property="og:image"]`)?.getAttribute(`content`)?.trim())return n;let r=t.querySelector(`meta[property="og:image:width"]`),i=t.querySelector(`meta[property="og:image:height"]`),a=Number.parseInt(r?.getAttribute(`content`)||``,10),o=Number.parseInt(i?.getAttribute(`content`)||``,10);return!r||!i||Number.isNaN(a)||Number.isNaN(o)?(n.push({ruleId:`og-image-size`,ruleName:`OG Image Size`,message:`Missing og:image:width and og:image:height meta tags - social platforms may crop your image incorrectly`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <meta property="og:image:width" content="1200" /> and <meta property="og:image:height" content="630" /> to your <head>.`}),n):((a<1200||o<630)&&n.push({ruleId:`og-image-size`,ruleName:`OG Image Size`,message:`OG image dimensions (${a}x${o}) are below recommended 1200x630 - may appear blurry on social platforms`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Use an image at least 1200x630 pixels for best display on Facebook, LinkedIn, and other social platforms.`,data:{width:a,height:o}}),n)}},I=new Set([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),ae=new Set([`.jpg`,`.jpeg`,`.png`,`.gif`,`.webp`]),L={meta:{id:`og-image-type`,name:`OG Image Type`,category:`SEO`,tier:`pro`,description:`Checks that the og:image type is a widely-supported format (JPEG, PNG, GIF, WebP)`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[property="og:image"]`)?.getAttribute(`content`)?.trim();if(!r)return n;let i=t.querySelector(`meta[property="og:image:type"]`)?.getAttribute(`content`)?.trim();if(i&&!I.has(i.toLowerCase()))return n.push({ruleId:`og-image-type`,ruleName:`OG Image Type`,message:`OG image type "${i}" may not be supported by all social platforms`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Use JPEG or PNG for og:image. These formats are supported by all social platforms.`,data:{type:i}}),n;if(!i)try{let e=new URL(r,`https://example.com`),t=e.pathname.substring(e.pathname.lastIndexOf(`.`)).toLowerCase();t&&!ae.has(t)&&n.push({ruleId:`og-image-type`,ruleName:`OG Image Type`,message:`OG image URL has extension "${t}" which may not be supported by all social platforms`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Use JPEG or PNG for og:image, and add <meta property="og:image:type" content="image/jpeg" /> to your <head>.`,data:{extension:t}})}catch{}return n}},R={meta:{id:`twitter-image`,name:`Twitter/X Image`,category:`SEO`,tier:`pro`,description:`Checks for twitter:image meta tag for rich card previews on X/Twitter`},run(e){let{document:t}=e,n=[];if(!t.querySelector(`meta[name="twitter:card"]`))return n;let r=t.querySelector(`meta[name="twitter:image"]`),i=t.querySelector(`meta[property="og:image"]`);return!r&&!i?n.push({ruleId:`twitter-image`,ruleName:`Twitter/X Image`,message:`Twitter card present but no twitter:image or og:image found - tweets will have no image preview`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <meta name="twitter:image" content="https://yoursite.com/image.png" /> to your <head>.`}):!r&&i&&n.push({ruleId:`twitter-image`,ruleName:`Twitter/X Image`,message:`No explicit twitter:image - falling back to og:image. Consider adding twitter:image for optimal display.`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add <meta name="twitter:image" content="..." /> for more control over how your image appears on X/Twitter.`}),n}},z={meta:{id:`social-preview-render`,name:`Social Preview Completeness`,category:`SEO`,tier:`pro`,description:`Checks that all essential meta tags for social sharing previews are present and consistent`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[property="og:title"]`)?.getAttribute(`content`),i=t.querySelector(`meta[property="og:description"]`)?.getAttribute(`content`),a=t.querySelector(`meta[property="og:image"]`)?.getAttribute(`content`),o=t.querySelector(`meta[property="og:url"]`)?.getAttribute(`content`),s=t.querySelector(`meta[property="og:type"]`)?.getAttribute(`content`),c=t.querySelector(`title`)?.textContent?.trim();return t.querySelector(`meta[name="description"]`)?.getAttribute(`content`),s||n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`Missing og:type meta tag - required by the Open Graph protocol and needed for correct social preview rendering`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <meta property="og:type" content="website" /> (or "article" for blog posts) to your <head>. This is a required property per the Open Graph protocol.`}),a&&a.trim()&&(t.querySelector(`meta[property="og:image:alt"]`)?.getAttribute(`content`)||n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`Missing og:image:alt - the Open Graph protocol recommends providing alt text when og:image is set`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add <meta property="og:image:alt" content="Description of the image" /> to your <head> for accessibility.`})),r&&c&&r.length>0&&c.length>0&&r.length>60&&n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`og:title is ${r.length} characters - may be truncated on social platforms (recommended: 50-60)`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Keep og:title under 60 characters for best display on social platforms.`,data:{ogTitleLength:r.length}}),i&&i.length>200&&n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`og:description is ${i.length} characters - may be truncated on social platforms (recommended: under 200)`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Keep og:description under 200 characters for best display on social platforms.`,data:{ogDescLength:i.length}}),o&&!o.startsWith(`http`)&&n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`og:url should be an absolute URL starting with https://`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Change og:url to an absolute URL (e.g., https://yoursite.com/page).`}),a&&!a.startsWith(`http`)&&n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`og:image should be an absolute URL starting with https://`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Change og:image to an absolute URL (e.g., https://yoursite.com/image.png).`}),n}},B={meta:{id:`title-keyword-stuffing`,name:`Title Keyword Stuffing`,category:`SEO`,tier:`pro`,description:`Detects potential keyword stuffing in the page title`},run(e){let{document:t}=e,n=[],r=t.querySelector(`title`)?.textContent?.trim();if(!r)return n;let i=r.toLowerCase().split(/[\s\-|:,]+/).filter(e=>e.length>3),a=new Map;for(let e of i)a.set(e,(a.get(e)||0)+1);let o=[];for(let[e,t]of a)t>=3&&o.push(`"${e}" (${t}x)`);o.length>0&&n.push({ruleId:`title-keyword-stuffing`,ruleName:`Title Keyword Stuffing`,message:`Potential keyword stuffing in title: ${o.join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Write a natural, readable title. Avoid repeating the same keyword more than twice. Search engines may penalize keyword stuffing.`,data:{title:r,stuffedWords:o}});let s=(r.match(/[|–—]/g)||[]).length;return s>=3&&n.push({ruleId:`title-keyword-stuffing`,ruleName:`Title Keyword Stuffing`,message:`Title has ${s} separators - may appear spammy to search engines`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Simplify your title. Use at most one separator (|, – or —) to separate the page name from your brand.`,data:{separatorCount:s}}),n}},V={meta:{id:`content-to-html-ratio`,name:`Content-to-HTML Ratio`,category:`SEO`,tier:`pro`,description:`Checks the ratio of visible text to total HTML markup`},run(e){let{document:t}=e,n=[],r=t.documentElement?.outerHTML?.length||0;if(r===0)return n;let i=(t.body?.textContent||``).replace(/\s+/g,` `).trim().length,a=Math.round(i/r*100);return a<10?n.push({ruleId:`content-to-html-ratio`,ruleName:`Content-to-HTML Ratio`,message:`Low content-to-HTML ratio (${a}%) - may indicate excessive markup or thin content`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Increase meaningful text content or reduce unnecessary HTML markup. Note: content-to-HTML ratio is not a direct ranking factor per Google, but correlates with page speed and code quality.`,data:{ratio:a,textLength:i,htmlLength:r}}):a<20&&n.push({ruleId:`content-to-html-ratio`,ruleName:`Content-to-HTML Ratio`,message:`Content-to-HTML ratio is ${a}% - could be improved (aim for 25%+)`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Consider adding more text content or reducing unnecessary HTML markup to improve the ratio.`,data:{ratio:a,textLength:i,htmlLength:r}}),n}},H={meta:{id:`title-uniqueness`,name:`Title Uniqueness`,category:`SEO`,tier:`pro`,description:`Flags titles that appear generic or auto-generated (single-page heuristic)`},run(e){let{document:t,url:n}=e,r=[],i=t.querySelector(`title`)?.textContent?.trim();if(!i)return r;for(let e of[/^home$/i,/^untitled/i,/^page \d+$/i,/^welcome$/i,/^index$/i,/^document$/i,/^my site$/i,/^my website$/i,/^website$/i,/^new page$/i])if(e.test(i)){r.push({ruleId:`title-uniqueness`,ruleName:`Title Uniqueness`,message:`Title "${i}" appears to be a generic/default title - use a unique, descriptive title`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Write a unique, descriptive title for each page that includes your target keyword.`,data:{title:i}});break}try{let e=new URL(n).hostname.replace(`www.`,``),t=e.split(`.`)[0];t&&i.toLowerCase()===t.toLowerCase()&&r.push({ruleId:`title-uniqueness`,ruleName:`Title Uniqueness`,message:`Title is just the domain name - add a descriptive page-specific title`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Include a page-specific description in your title, e.g., "Product Name — Your Brand".`,data:{title:i,hostname:e}})}catch{}return r}},U={meta:{id:`description-uniqueness`,name:`Description Uniqueness`,category:`SEO`,tier:`pro`,description:`Flags meta descriptions that appear generic or auto-generated (single-page heuristic)`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[name="description"]`)?.getAttribute(`content`)?.trim();if(!r)return n;for(let e of[/^welcome to/i,/^this is a website/i,/^a website about/i,/^home page/i,/^we are a company/i,/^default description/i])if(e.test(r)){n.push({ruleId:`description-uniqueness`,ruleName:`Description Uniqueness`,message:`Meta description appears generic - write a unique, compelling description for this page`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Write a unique meta description for each page that summarizes the specific content and includes a call to action.`,data:{description:r}});break}let i=t.querySelector(`title`)?.textContent?.trim();return i&&r.toLowerCase()===i.toLowerCase()&&n.push({ruleId:`description-uniqueness`,ruleName:`Description Uniqueness`,message:`Meta description is identical to the title - they should be different and complementary`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Write a meta description that expands on your title with more detail, a value proposition, or a call to action.`,data:{description:r,title:i}}),n}},W={Organization:[`name`,`url`],WebSite:[`name`,`url`],WebPage:[`name`],BreadcrumbList:[`itemListElement`],LocalBusiness:[`name`,`address`]},G={Article:[`headline`,`author`,`datePublished`],Product:[`name`,`image`,`offers`]};function K(e,t,n){let r=e[`@type`];if(!r){n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`JSON-LD block missing @type property`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add an @type property (e.g., "Organization", "WebPage", "Article") to your JSON-LD.`});return}e[`@context`]||t||n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`JSON-LD "${r}" missing @context - should be "https://schema.org"`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add "@context": "https://schema.org" to your JSON-LD block.`,data:{type:r}});let i=W[r];if(i){let t=i.filter(t=>!e[t]);t.length>0&&n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`JSON-LD "${r}" missing required fields: ${t.join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add the missing fields to your ${r} schema: ${t.join(`, `)}.`,data:{type:r,missing:t}})}let a=G[r];if(a){let t=a.filter(t=>!e[t]);t.length>0&&n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`JSON-LD "${r}" missing recommended fields: ${t.join(`, `)}`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add the recommended fields to your ${r} schema for richer search results: ${t.join(`, `)}.`,data:{type:r,missing:t}})}r===`FAQPage`&&n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`FAQPage rich results are only shown for well-known, authoritative government and health websites. For all other sites, this rich result will no longer be shown regularly`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`You can keep or remove this markup. Unused structured data does not cause problems for Search, but it also has no visible effects in Google Search. Consider using other structured data types that still produce rich results for your site type.`,data:{type:r}})}var q={meta:{id:`structured-data-validate`,name:`Structured Data Validation`,category:`SEO`,tier:`pro`,description:`Validates JSON-LD structured data for required fields based on schema type`},run(e){let{document:t}=e,n=[];return t.querySelectorAll(`script[type="application/ld+json"]`).forEach(e=>{let t;try{t=JSON.parse(e.textContent||``)}catch{return}if(Array.isArray(t[`@graph`])){let e=t[`@context`];for(let r of t[`@graph`])K(r,e,n);return}K(t,void 0,n)}),n}},J={meta:{id:`hreflang`,name:`Hreflang Tags`,category:`SEO`,tier:`pro`,description:`Validates hreflang tags for multi-language pages`},run(e){let{document:t,url:n}=e,r=[],i=t.querySelectorAll(`link[rel="alternate"][hreflang]`);if(i.length===0)return r;Array.from(i).some(e=>e.getAttribute(`hreflang`)===`x-default`)||r.push({ruleId:`hreflang`,ruleName:`Hreflang Tags`,message:`Hreflang tags found but missing x-default - add a fallback for unmatched languages`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <link rel="alternate" hreflang="x-default" href="..." /> to specify the default/fallback page.`}),Array.from(i).some(e=>{let t=e.getAttribute(`href`);return t===n||t===n.replace(/\/$/,``)})||r.push({ruleId:`hreflang`,ruleName:`Hreflang Tags`,message:`Hreflang tags do not include a self-referencing tag for the current page`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add a hreflang tag that points to the current page URL with the appropriate language code.`});let a=/^[a-z]{2}(-[A-Z]{2})?$/;return i.forEach(e=>{let t=e.getAttribute(`hreflang`);t&&t!==`x-default`&&!a.test(t)&&r.push({ruleId:`hreflang`,ruleName:`Hreflang Tags`,message:`Invalid hreflang language code "${t}" - use ISO 639-1 format (e.g., "en", "en-US")`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Change "${t}" to a valid ISO 639-1 language code (e.g., "en", "fr", "de-AT").`,data:{invalidLang:t}});let n=e.getAttribute(`href`);n&&!n.startsWith(`http`)&&r.push({ruleId:`hreflang`,ruleName:`Hreflang Tags`,message:`Hreflang href should be an absolute URL (found: "${n}")`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Use absolute URLs (starting with https://) for all hreflang href attributes.`})}),r}},oe={meta:{id:`canonical-self-referencing`,name:`Canonical Self-Referencing`,category:`SEO`,tier:`pro`,description:`Checks that the canonical URL points to the current page (self-referencing canonical)`},run(e){let{document:t,url:n}=e,r=[],i=t.querySelector(`link[rel="canonical"]`);if(!i)return r;let a=i.getAttribute(`href`)?.trim();if(!a)return r;let o=e=>e.replace(/\/$/,``).toLowerCase();try{let e=new URL(a,n).href;o(e)!==o(n)&&(new URL(e).hostname===new URL(n).hostname?r.push({ruleId:`canonical-self-referencing`,ruleName:`Canonical Self-Referencing`,message:`Canonical URL points to a different page on the same site - this tells search engines to index "${e}" instead of this page`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`If this page should be indexed, change the canonical to point to itself. If this is intentional (e.g., pagination), you can ignore this.`,data:{canonical:e,pageUrl:n}}):r.push({ruleId:`canonical-self-referencing`,ruleName:`Canonical Self-Referencing`,message:`Canonical URL points to a different domain ("${new URL(e).hostname}") - this is unusual and may be a misconfiguration`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Cross-domain canonical tags are rarely correct. Verify this is intentional, otherwise change the canonical to point to this page.`,data:{canonical:e,pageUrl:n}}))}catch{r.push({ruleId:`canonical-self-referencing`,ruleName:`Canonical Self-Referencing`,message:`Cannot parse canonical URL "${a}" - ensure it's a valid absolute URL`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Use a valid absolute URL for your canonical tag (e.g., https://yoursite.com/page).`})}return r}},se={meta:{id:`meta-render-blocking`,name:`Render-Blocking Resources`,category:`Performance`,tier:`pro`,description:`Checks for render-blocking stylesheets and synchronous scripts in the <head>`},run(e){let{document:t}=e,n=[],r=t.querySelector(`head`);if(!r)return n;let i=r.querySelectorAll(`script[src]`),a=0;i.forEach(e=>{let t=e.hasAttribute(`async`),n=e.hasAttribute(`defer`),r=e.getAttribute(`type`);!t&&!n&&r!==`module`&&a++}),a>0&&n.push({ruleId:`meta-render-blocking`,ruleName:`Render-Blocking Resources`,message:`${a} synchronous script(s) in <head> may block page rendering`,severity:`WARNING`,category:`Performance`,tier:`pro`,fix:`Add async or defer attributes to non-critical scripts in the <head>, or move them to the end of <body>.`,data:{blockingScripts:a}});let o=r.querySelectorAll(`link[rel="stylesheet"]`),s=0;return o.forEach(e=>{let t=e.getAttribute(`media`);(!t||t===`all`)&&s++}),s>3&&n.push({ruleId:`meta-render-blocking`,ruleName:`Render-Blocking Resources`,message:`${s} render-blocking stylesheets in <head> - consider inlining critical CSS`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Inline critical CSS and load non-critical stylesheets asynchronously using media="print" with an onload handler.`,data:{blockingStylesheets:s}}),n}},ce={meta:{id:`lazy-load-lcp`,name:`Lazy Load LCP`,category:`Performance`,tier:`pro`,description:`Checks that above-the-fold images (likely LCP candidates) are not lazy-loaded`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`img`),i=Array.from(r).slice(0,3);for(let e of i){let t=e.getAttribute(`loading`),r=e.getAttribute(`fetchpriority`);if(t===`lazy`){let t=e.getAttribute(`src`)||``,r=e.getAttribute(`alt`)||``,i=r?`"${r.substring(0,40)}"`:t?`src="${t.substring(0,50)}"`:`first image`;n.push({ruleId:`lazy-load-lcp`,ruleName:`Lazy Load LCP`,message:`Above-the-fold image (${i}) has loading="lazy" - this delays the Largest Contentful Paint`,severity:`WARNING`,category:`Performance`,tier:`pro`,fix:`Remove loading="lazy" from above-the-fold images. Add fetchpriority="high" to the LCP image instead.`});break}if(!r&&!t){n.push({ruleId:`lazy-load-lcp`,ruleName:`Lazy Load LCP`,message:`Consider adding fetchpriority="high" to your hero/banner image to improve Largest Contentful Paint`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Add fetchpriority="high" to the most important above-the-fold image to prioritize its loading.`});break}}return n}},le={meta:{id:`https-links`,name:`HTTPS Links`,category:`Pre-Launch`,tier:`pro`,description:`Checks that internal links use HTTPS instead of HTTP`},run(e){let{document:t,url:n}=e,r=[],i;try{i=new URL(n).hostname}catch{return r}let a=t.querySelectorAll(`a[href^="http:"]`),o=0,s=0;return a.forEach(e=>{let t=e.getAttribute(`href`);if(t)try{new URL(t).hostname===i?o++:s++}catch{}}),o>0&&r.push({ruleId:`https-links`,ruleName:`HTTPS Links`,message:`${o} internal link(s) use HTTP instead of HTTPS`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Change all internal links from http:// to https:// to avoid redirect chains and mixed content warnings.`,data:{internalHttpLinks:o}}),s>0&&r.push({ruleId:`https-links`,ruleName:`HTTPS Links`,message:`${s} external link(s) use HTTP - consider updating to HTTPS where available`,severity:`INFO`,category:`Pre-Launch`,tier:`pro`,fix:`Update external links to use https:// where the destination supports it.`,data:{externalHttpLinks:s}}),r}},ue={meta:{id:`meta-refresh-redirect`,name:`Meta Refresh Redirect`,category:`SEO`,tier:`pro`,description:`Checks for <meta http-equiv="refresh"> redirects which are bad for SEO`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[http-equiv="refresh"]`);if(!r)return n;let i=r.getAttribute(`content`)||``,a=i.toLowerCase().includes(`url=`),o=Number.parseInt(i.split(`;`)[0]||``,10);return a?n.push({ruleId:`meta-refresh-redirect`,ruleName:`Meta Refresh Redirect`,message:`Page uses a meta refresh redirect${Number.isNaN(o)?``:` (${o}s delay)`} - use server-side 301 redirects instead`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Replace <meta http-equiv="refresh"> with a server-side 301 redirect. Meta refreshes are bad for SEO and user experience.`,data:{content:i,delay:Number.isNaN(o)?void 0:o}}):!Number.isNaN(o)&&o>0&&n.push({ruleId:`meta-refresh-redirect`,ruleName:`Meta Refresh Redirect`,message:`Page auto-refreshes every ${o} seconds - this may cause usability issues`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Consider removing the auto-refresh meta tag unless it serves a clear user need.`,data:{content:i,delay:o}}),n}},Y={meta:{id:`nofollow-audit`,name:`Nofollow Audit`,category:`SEO`,tier:`pro`,description:`Audits the use of rel="nofollow" on internal vs. external links`},run(e){let{document:t,url:n}=e,r=[],i;try{i=new URL(n).hostname}catch{return r}let a=t.querySelectorAll(`a[rel~="nofollow"]`),o=0;return a.forEach(e=>{let t=e.getAttribute(`href`);if(t)try{new URL(t,n).hostname===i&&o++}catch{(t.startsWith(`/`)||t.startsWith(`.`))&&o++}}),o>0&&r.push({ruleId:`nofollow-audit`,ruleName:`Nofollow Audit`,message:`${o} internal link(s) have rel="nofollow" - this wastes PageRank and hurts internal linking`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove rel="nofollow" from internal links. Nofollow should only be used for external links you do not want to endorse (e.g., user-generated content, sponsored links).`,data:{internalNofollow:o,totalNofollow:a.length}}),r}},de={meta:{id:`cors-policy`,name:`CORS Policy`,category:`Pre-Launch`,tier:`pro`,description:`Checks for overly permissive CORS configuration that could allow unauthorized cross-origin access`},async run(e){let t=[],n=`https://evil.example.com`;try{let r=await fetch(e,{method:`GET`,headers:{"User-Agent":`LintPage-Bot/1.0`,Origin:n},redirect:`follow`}),i=r.headers.get(`access-control-allow-origin`),a=r.headers.get(`access-control-allow-credentials`);if(!i)return t;i===`*`?a?.toLowerCase()===`true`?t.push({ruleId:`cors-policy`,ruleName:`CORS Policy`,message:`CORS allows all origins with credentials enabled - this is a security vulnerability`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Set Access-Control-Allow-Origin to your specific trusted domains instead of "*". Wildcard with credentials is blocked by browsers but indicates a dangerous misconfiguration.`}):t.push({ruleId:`cors-policy`,ruleName:`CORS Policy`,message:`CORS allows all origins (Access-Control-Allow-Origin: *) - restrict to trusted domains in production. Note: some hosting platforms (e.g. Vercel, Netlify, Cloudflare Pages) add this header by default, even if you haven't configured it.`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`If you set this header yourself, configure Access-Control-Allow-Origin to only allow requests from your trusted domains (e.g., "https://myapp.com") instead of using the wildcard "*". If your hosting platform adds it automatically, check their documentation for how to override or restrict CORS headers.`}):i.toLowerCase()===n&&(a?.toLowerCase()===`true`?t.push({ruleId:`cors-policy`,ruleName:`CORS Policy`,message:`CORS reflects any origin with credentials enabled - any website can make authenticated cross-origin requests and read responses. This is the most exploitable CORS misconfiguration.`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Configure your server to validate the Origin header against a strict allowlist of trusted domains. Never reflect arbitrary origins when credentials are enabled.`}):t.push({ruleId:`cors-policy`,ruleName:`CORS Policy`,message:`CORS reflects any origin back in Access-Control-Allow-Origin - this is equivalent to a wildcard and allows any site to make cross-origin requests. Note: this may be caused by your hosting platform or a reverse proxy, not your own configuration.`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`If you set this header yourself, configure your server to validate the Origin header against an allowlist of trusted domains instead of reflecting it back. If your hosting platform adds it automatically, check their documentation for how to override or restrict CORS headers.`}))}catch{}return t}},X=50,Z=1e4,fe={name:`@lintpage/pro`,rules:[v,x,S,C,w,T,E,D,O,k,A,j,N,P,F,L,R,z,B,V,H,U,q,J,oe,se,ce,le,ue,Y],asyncRules:[{meta:{id:`broken-internal-links`,name:`Broken Internal Links`,category:`SEO`,tier:`pro`,description:`Checks that internal links on the page resolve successfully (no 404s or server errors)`},async run(e){let{document:t,url:n}=e,r=[],i;try{i=new URL(n)}catch{return r}let a=new Set,o=[],s=t.querySelectorAll(`a[href]`);for(let e of s){let t=e.getAttribute(`href`);if(!t||t.startsWith(`#`)||t.startsWith(`mailto:`)||t.startsWith(`tel:`)||t.startsWith(`javascript:`)||t.startsWith(`data:`))continue;let r;try{r=new URL(t,n)}catch{continue}if(r.hostname!==i.hostname)continue;r.hash=``;let s=r.toString();if(a.has(s))continue;a.add(s);let c=new URL(n);c.hash=``,s!==c.toString()&&o.push(s)}if(o.length===0)return r;let c=o.slice(0,X),l=[],u=[],d=async e=>{try{let t=await fetch(e,{method:`HEAD`,headers:{"User-Agent":`LintPage-Bot/1.0`},redirect:`follow`,signal:AbortSignal.timeout(Z)});if(t.status===405){let t=await fetch(e,{method:`GET`,headers:{"User-Agent":`LintPage-Bot/1.0`},redirect:`follow`,signal:AbortSignal.timeout(Z)});t.status>=400&&l.push({url:e,status:t.status});return}t.status>=400&&l.push({url:e,status:t.status})}catch{u.push(e)}};for(let e=0;e<c.length;e+=10){let t=c.slice(e,e+10);await Promise.all(t.map(d))}if(l.length>0){let e=l.filter(e=>e.status===404),t=l.filter(e=>e.status>=500),n=l.filter(e=>e.status!==404&&e.status<500);e.length>0&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`${e.length} internal link(s) return 404 Not Found: ${e.map(e=>e.url).join(`, `)}`,severity:`CRITICAL`,category:`SEO`,tier:`pro`,fix:`Remove or update the broken links to point to valid pages. Broken internal links hurt SEO and user experience.`,data:{notFoundLinks:e}}),t.length>0&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`${t.length} internal link(s) return server errors: ${t.map(e=>`${e.url} (${e.status})`).join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Investigate server errors on the linked pages. These may indicate temporary issues or misconfigured routes.`,data:{serverErrorLinks:t}}),n.length>0&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`${n.length} internal link(s) return client errors: ${n.map(e=>`${e.url} (${e.status})`).join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Check the linked pages for access issues (e.g., 401/403 may indicate authentication or permission problems).`,data:{clientErrorLinks:n}})}return u.length>0&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`${u.length} internal link(s) could not be reached: ${u.join(`, `)}`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`These links timed out or had network errors during the check. Verify they are accessible.`,data:{unreachableLinks:u}}),o.length>X&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`Only checked ${X} of ${o.length} internal links. Consider reducing the number of links on this page.`,severity:`INFO`,category:`SEO`,tier:`pro`,data:{totalLinks:o.length,checkedLinks:X}}),r}}],standaloneRules:[y,b,M,de]};function pe(){return fe}const Q=(0,n.default)(`lintpage`);Q.command(`<url>`,`Run an audit on a URL`).option(`--format <format>`,`Output format: text, json, github`,{default:`text`}).option(`--config <path>`,`Path to config file`).option(`--fail-on-warning`,`Exit 1 on warnings (not just criticals)`).option(`--quiet`,`Minimal output (counts only)`).action(async(n,r)=>{let i=r.format||`text`,a=r.config,o=!!r.failOnWarning,s=!!r.quiet;try{let r=n;!r.startsWith(`http://`)&&!r.startsWith(`https://`)&&(r=`https://${r}`);let c=ie(a)??void 0;!s&&i===`text`&&console.log(t.default.dim(`Auditing ${r}...`));let l=await g(r,{plugins:[pe()],config:c});console.log(e.t(l,i,s));let u=l.results.some(e=>e.severity===`CRITICAL`),d=l.results.some(e=>e.severity===`WARNING`);u&&process.exit(1),o&&d&&process.exit(1),process.exit(0)}catch(e){i===`json`?console.error(JSON.stringify({error:e instanceof Error?e.message:String(e)})):console.error(t.default.red(`Error: ${e instanceof Error?e.message:String(e)}`)),process.exit(2)}}),Q.command(`init`,`Generate a .lintpagerc.json config file`).action(()=>{let e=(0,a.join)(process.cwd(),`.lintpagerc.json`);(0,i.existsSync)(e)&&(console.log(t.default.yellow(`.lintpagerc.json already exists`)),process.exit(0));let n=_();(0,i.writeFileSync)(e,JSON.stringify(n,null,2)+`
3
- `),console.log(t.default.green(`Created .lintpagerc.json`)),process.exit(0)}),Q.help();const $=(0,a.join)(__dirname,`..`,`package.json`),me=(0,i.existsSync)($)?JSON.parse((0,i.readFileSync)($,`utf-8`)):{version:`0.0.0`};Q.version(me.version);try{Q.parse()}catch(e){e instanceof Error&&e.message?(console.error(t.default.red(`Error: ${e.message}`)),console.error(t.default.dim(`Run "lintpage --help" for usage information.`))):console.error(t.default.red(`Error: ${String(e)}`)),process.exit(2)}
1
+ const e=require(`./formatter-BFKK5Mks.cjs`);let t=require(`chalk`);t=e.a(t);let n=require(`cac`);n=e.a(n);let r=require(`dns/promises`);r=e.a(r);let i=require(`fs`),a=require(`path`);var o=[{meta:{id:`title`,name:`Page Title`,category:`SEO`,tier:`free`,description:`Checks for the presence and length of the <title> tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`title`)?.textContent?.trim()||``,i=r.length;return r?i<30?n.push({ruleId:`title`,ruleName:`Page Title`,message:`Title may be too short - under 30 characters may not be descriptive enough`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Expand your title to 50-60 characters to avoid truncation. Google does not enforce a character limit but truncates based on pixel width (~600px on desktop).`,data:{value:r,length:i}}):i>60&&n.push({ruleId:`title`,ruleName:`Page Title`,message:`Title is over 60 characters - likely to be truncated in search results`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Shorten your title to under 60 characters to avoid truncation. Google truncates based on pixel width (~600px on desktop), which is roughly 60 characters.`,data:{value:r,length:i}}):n.push({ruleId:`title`,ruleName:`Page Title`,message:`Missing title tag`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add a <title>Your Page Title</title> tag inside your <head> element. Aim for 50-60 characters to avoid truncation in search results.`,data:{value:r,length:i}}),n}},{meta:{id:`meta-description`,name:`Meta Description`,category:`SEO`,tier:`free`,description:`Checks for the presence and length of the meta description tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[name="description"]`)?.getAttribute(`content`)?.trim()||``,i=r.length;return r?i<120?n.push({ruleId:`meta-description`,ruleName:`Meta Description`,message:`Meta description may be too short - under 120 characters may not fully utilize the available snippet space`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Expand your meta description to 150-160 characters. Google does not enforce a character limit but typically truncates around 160 characters on desktop (~120 on mobile).`,data:{value:r,length:i}}):i>160&&n.push({ruleId:`meta-description`,ruleName:`Meta Description`,message:`Meta description is over 160 characters - likely to be truncated in search results`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Shorten your meta description to under 160 characters. Google truncates snippets based on device width, typically around 160 characters on desktop.`,data:{value:r,length:i}}):n.push({ruleId:`meta-description`,ruleName:`Meta Description`,message:`Missing meta description`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta name="description" content="Your description here" /> to your <head> tag. Aim for 150-160 characters to avoid truncation.`,data:{value:r,length:i}}),n}},{meta:{id:`og-title`,name:`Open Graph Title`,category:`SEO`,tier:`free`,description:`Checks for the og:title meta tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[property="og:title"]`)?.getAttribute(`content`)?.trim()||``;return r?r.length>60?n.push({ruleId:`og-title`,ruleName:`Open Graph Title`,message:`og:title is long (${r.length} characters). Optimal: 50-60 characters`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Shorten your og:title to under 60 characters. Longer titles get truncated on most social platforms.`,data:{value:r,length:r.length}}):r.length<30&&n.push({ruleId:`og-title`,ruleName:`Open Graph Title`,message:`og:title is short (${r.length} characters). Optimal: 50-60 characters`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Consider expanding your og:title to 50-60 characters to make social shares more compelling.`,data:{value:r,length:r.length}}):n.push({ruleId:`og-title`,ruleName:`Open Graph Title`,message:`Missing og:title tag - social media shares will have no title preview`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta property="og:title" content="Your Page Title" /> to your <head> tag.`}),n}},{meta:{id:`og-description`,name:`Open Graph Description`,category:`SEO`,tier:`free`,description:`Checks for the og:description meta tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[property="og:description"]`)?.getAttribute(`content`)?.trim()||``;return r?r.length>200?n.push({ruleId:`og-description`,ruleName:`Open Graph Description`,message:`og:description is long (${r.length} characters). Optimal: 110-160 characters`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Shorten your og:description to under 200 characters. Most platforms truncate longer descriptions.`,data:{value:r,length:r.length}}):r.length<70&&n.push({ruleId:`og-description`,ruleName:`Open Graph Description`,message:`og:description is short (${r.length} characters). Optimal: 110-160 characters`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Consider expanding your og:description to 110-160 characters to make social shares more engaging.`,data:{value:r,length:r.length}}):n.push({ruleId:`og-description`,ruleName:`Open Graph Description`,message:`Missing og:description tag - social media shares will have no description preview`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta property="og:description" content="Your description" /> to your <head> tag.`}),n}},{meta:{id:`og-image`,name:`Open Graph Image`,category:`SEO`,tier:`free`,description:`Checks for the og:image meta tag`},run(e){let{document:t}=e,n=[];return t.querySelector(`meta[property="og:image"]`)?.getAttribute(`content`)||n.push({ruleId:`og-image`,ruleName:`Open Graph Image`,message:`Missing og:image tag - social media shares will have no image preview`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta property="og:image" content="https://yoursite.com/image.jpg" /> to your <head> tag.`}),n}},{meta:{id:`og-url`,name:`Open Graph URL`,category:`SEO`,tier:`free`,description:`Checks for the og:url meta tag`},run(e){let{document:t}=e,n=[];return t.querySelector(`meta[property="og:url"]`)?.getAttribute(`content`)||n.push({ruleId:`og-url`,ruleName:`Open Graph URL`,message:`Missing og:url tag - social media may not show the correct URL`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta property="og:url" content="https://yoursite.com/page" /> to your <head> tag.`}),n}},{meta:{id:`twitter-card`,name:`Twitter Card`,category:`SEO`,tier:`free`,description:`Checks for Twitter Card meta tags`},run(e){let{document:t}=e,n=[];return t.querySelector(`meta[name="twitter:card"]`)?.getAttribute(`content`)||n.push({ruleId:`twitter-card`,ruleName:`Twitter Card`,message:`Missing Twitter Card tags - tweets with your URL will have no preview card`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta name="twitter:card" content="summary_large_image" />, <meta name="twitter:title" content="..." />, and <meta name="twitter:image" content="..." /> to your <head>.`}),n}},{meta:{id:`canonical-url`,name:`Canonical URL`,category:`SEO`,tier:`free`,description:`Checks for a canonical link tag and validates the URL`},run(e){let{document:t}=e,n=[],r=t.querySelector(`link[rel="canonical"]`),i=r?.getAttribute(`href`)||void 0;return r?i&&!i.startsWith(`http`)&&n.push({ruleId:`canonical-url`,ruleName:`Canonical URL`,message:`Canonical URL should be absolute (include protocol and domain)`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Change your canonical href to an absolute URL starting with https:// (e.g., href="https://yoursite.com/page").`,data:{present:!0,value:i}}):n.push({ruleId:`canonical-url`,ruleName:`Canonical URL`,message:`No canonical link found (recommended for SEO)`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Add <link rel="canonical" href="https://yoursite.com/this-page" /> to your <head> tag to prevent duplicate content issues.`,data:{present:!1}}),n}},{meta:{id:`robots-noindex`,name:`Robots Noindex`,category:`Pre-Launch`,tier:`free`,description:`Checks for noindex/nofollow in the robots meta tag`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[name="robots"]`)?.getAttribute(`content`)||``;return r.includes(`noindex`)&&n.push({ruleId:`robots-noindex`,ruleName:`Robots Noindex`,message:`Page has noindex meta tag - WILL NOT BE INDEXED by search engines! Remove this before launch or you'll get ZERO organic traffic.`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`free`,fix:`Remove the <meta name="robots" content="noindex" /> tag from your <head>, or change it to content="index, follow".`,data:{metaRobots:r}}),r.includes(`nofollow`)&&n.push({ruleId:`robots-noindex`,ruleName:`Robots Noindex`,message:`Page has nofollow meta tag - links will not be followed`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Remove "nofollow" from your <meta name="robots"> content if you want search engines to follow your links.`,data:{metaRobots:r}}),n}},{meta:{id:`heading-structure`,name:`Heading Structure`,category:`SEO`,tier:`free`,description:`Validates H1 tag presence, count, and heading hierarchy`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`h1`),i=r.length,a=Array.from(r).map(e=>e.textContent?.trim()||``);i===0?n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`No H1 tag found`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add a single <h1> tag to your page with a clear, descriptive heading that includes your primary keyword.`,data:{h1Count:i}}):i>1&&n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`Multiple H1 tags found (${i}). Best practice is 1 per page`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`While Google does not penalize multiple H1 tags, using a single H1 per page is a widely recommended best practice for clarity and accessibility.`,data:{h1Count:i,h1Values:a}}),a.forEach((e,t)=>{e?e.length>70&&n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`H1 #${t+1} is too long (${e.length} characters)`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Shorten your H1 to under 70 characters for better readability and SEO.`}):n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`H1 #${t+1} is empty`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add descriptive text content to your <h1> tag.`})});let o=t.querySelectorAll(`h1, h2, h3, h4, h5, h6`),s=0;return Array.from(o).forEach(e=>{let t=Number.parseInt(e.tagName[1]??`1`,10);if(t-s>1){let t=e.textContent?.trim().substring(0,40)||`...`;n.push({ruleId:`heading-structure`,ruleName:`Heading Structure`,message:`${e.tagName} skips heading level from h${s} (content: "${t}")`,severity:`INFO`,category:`SEO`,tier:`free`,fix:`Don't skip heading levels. Use h${s+1} instead of ${e.tagName} to maintain proper hierarchy.`})}s=t}),n}},{meta:{id:`html-lang`,name:`HTML Lang Attribute`,category:`Accessibility`,tier:`free`,description:`Checks for the lang attribute on the <html> tag`},run(e){let{document:t}=e,n=[];return t.documentElement.getAttribute(`lang`)||n.push({ruleId:`html-lang`,ruleName:`HTML Lang Attribute`,message:`Missing lang attribute on <html> tag`,severity:`WARNING`,category:`Accessibility`,tier:`free`,fix:`Add lang="en" (or your language code) to your <html> tag: <html lang="en">.`,data:{present:!1}}),n}},{meta:{id:`viewport`,name:`Viewport Meta Tag`,category:`SEO`,tier:`free`,description:`Checks for the viewport meta tag for mobile responsiveness`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[name="viewport"]`);if(!r)n.push({ruleId:`viewport`,ruleName:`Viewport Meta Tag`,message:`Missing viewport meta tag - page will not render properly on mobile devices`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <meta name="viewport" content="width=device-width, initial-scale=1" /> to your <head> tag.`,data:{present:!1}});else{let e=r.getAttribute(`content`)||``,t=/user-scalable\s*=\s*no/i.test(e),i=e.match(/maximum-scale\s*=\s*([\d.]+)/i),a=i&&parseFloat(i[1])<2;(t||a)&&n.push({ruleId:`viewport`,ruleName:`Viewport Meta Tag`,message:`Viewport disables or restricts user zoom - this fails WCAG 1.4.4 (Resize text) which requires at least 200% zoom`,severity:`WARNING`,category:`Accessibility`,tier:`free`,fix:`Remove user-scalable=no and ensure maximum-scale is at least 2.0 (or remove it entirely) to allow users to zoom.`})}return n}},{meta:{id:`favicon`,name:`Favicon`,category:`SEO`,tier:`free`,description:`Checks for the presence of a favicon link tag`},run(e){let{document:t}=e,n=[];return t.querySelector(`link[rel*="icon"]`)||n.push({ruleId:`favicon`,ruleName:`Favicon`,message:`No favicon found - browsers will show a default icon in tabs and bookmarks`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add <link rel="icon" href="/favicon.ico" /> to your <head> tag. Include multiple sizes for best results.`,data:{present:!1}}),n}},{meta:{id:`anchor-missing-href`,name:`Anchor Missing Href`,category:`SEO`,tier:`free`,description:`Checks that all <a> elements have a valid href attribute`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`a`),i=[];for(let e of r){let t=e.getAttribute(`href`);if(!t||t.trim()===``){let t=e.textContent?.trim()||``,n=t.length>50?t.slice(0,50)+`…`:t;i.push(n||`<empty>`)}}return i.length>0&&n.push({ruleId:`anchor-missing-href`,ruleName:`Anchor Missing Href`,message:`${i.length} <a> element(s) missing a valid href attribute: ${i.join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`free`,fix:`Add a valid href attribute to all <a> elements. Links without href are not crawlable by search engines and inaccessible to keyboard/screen reader users. If the element is not a link, use a <button> or <span> instead.`,data:{count:i.length,anchors:i}}),n}}];new Map(o.map(e=>[e.meta.id,e]));function s(e){let t=e.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);if(!t)return!1;let[,n,r]=t.map(Number);return n===10||n===172&&r>=16&&r<=31||n===192&&r===168||n===127||n===169&&r===254||n===0||n===100&&r>=64&&r<=127||n===198&&(r===18||r===19)||n>=224}function c(e){return!!(e===`localhost`||e===`127.0.0.1`||e===`[::1]`||e===`0.0.0.0`||e.endsWith(`.internal`)||e.endsWith(`.local`)||e.endsWith(`.localhost`)||s(e)||e.startsWith(`[`)&&(e===`[::1]`||e.startsWith(`[fc`)||e.startsWith(`[fd`)||e.startsWith(`[fe80:`)))}async function l(e,t){let n=e.replace(/^\[|\]$/g,``),i=Date.now();t?.({step:`dns`,status:`start`,host:n});try{let{address:e}=await r.default.lookup(n);if(s(e)){let e=`URLs pointing to private or internal addresses are not allowed`;throw t?.({step:`dns`,status:`fail`,host:n,error:e}),Error(e)}let a=Date.now()-i;return t?.({step:`dns`,status:`ok`,host:n,address:e,ms:a}),{address:e,ms:a}}catch(e){if(e instanceof Error&&e.message.includes(`private or internal`))throw e;let r=`Could not resolve hostname`;throw t?.({step:`dns`,status:`fail`,host:n,error:r}),Error(r)}}function u(e){let t;try{t=new URL(e)}catch{throw Error(`Invalid URL`)}if(t.protocol!==`http:`&&t.protocol!==`https:`)throw Error(`Only HTTP and HTTPS URLs are allowed`);if(c(t.hostname))throw Error(`URLs pointing to private or internal addresses are not allowed`)}async function d(e,t){try{u(e),t?.({step:`validate`,status:`ok`})}catch(e){let n=e instanceof Error?e.message:`Invalid URL`;throw t?.({step:`validate`,status:`fail`,error:n}),e}return l(new URL(e).hostname,t)}var f=`Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 LintPage/1.0 (+https://lintpage.com)`;async function p(e,t){let{onStep:n}=t??{};await d(e,n);let r=Date.now();n?.({step:`fetch`,status:`start`,url:e});let i;try{i=await fetch(e,{headers:{"User-Agent":f,Accept:`text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8`,"Accept-Language":`en-US,en;q=0.9`,"Accept-Encoding":`gzip, deflate, br`},signal:AbortSignal.timeout(3e4)})}catch(e){let t=e instanceof Error?e.message:`fetch failed`;throw n?.({step:`fetch`,status:`fail`,error:t}),e}let a=Date.now()-r;if(!i.ok){let e=`Failed to fetch URL: ${i.status} ${i.statusText}`;throw n?.({step:`fetch`,status:`fail`,error:e,statusCode:i.status}),Error(e)}n?.({step:`fetch`,status:`ok`,statusCode:i.status,contentType:i.headers.get(`content-type`),ttfbMs:a}),n?.({step:`parse`,status:`start`});let o;try{o=await i.text()}catch(e){let t=e instanceof Error?e.message:`failed to read body`;throw n?.({step:`parse`,status:`fail`,error:t}),e}let s;try{let{JSDOM:e}=await import(`jsdom`);s=new e(o).window.document,n?.({step:`parse`,status:`ok`,sizeBytes:Buffer.byteLength(o,`utf8`)})}catch(e){let t=e instanceof Error?e.message:`failed to parse HTML`;throw n?.({step:`parse`,status:`fail`,error:t}),e}return{document:s,response:i,html:o,ttfbMs:a}}var m={"Pre-Launch":25,SEO:30,"AI Visibility":10,Accessibility:20,Performance:15};function h(e){let t={};for(let e of Object.keys(m))t[e]={critical:0,warning:0,info:0};for(let n of e){let e=n.category;t[e]||(t[e]={critical:0,warning:0,info:0}),n.severity===`CRITICAL`?t[e].critical++:n.severity===`WARNING`?t[e].warning++:t[e].info++}let n={};for(let[e,r]of Object.entries(m)){let i=t[e]||{critical:0,warning:0,info:0},a=Math.min(100,i.critical*30+i.warning*5+i.info*1);n[e]={score:Math.round(r*(1-a/100)*10)/10,max:r,deductionPercent:a}}return n}function g(e){let t=h(e),n=Object.values(t).reduce((e,t)=>e+t.score,0);return Math.round(n)}function ee(e,t,n){let r=[];for(let i of e){if(n?.rules){let e=n.rules[i.meta.id];if(e===!1||typeof e==`object`&&e.enabled===!1)continue}try{let e=i.run(t);r.push(...e)}catch(e){console.warn(`[lintpage] Rule "${i.meta.id}" threw an error: ${e instanceof Error?e.message:String(e)}`)}}return r}function _(e,t){if(!t?.rules)return!0;let n=t.rules[e];return!(n===!1||typeof n==`object`&&n.enabled===!1)}async function te(e,t,n){let r=e.filter(e=>_(e.meta.id,n)),i=await Promise.allSettled(r.map(e=>e.run(t))),a=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.status===`fulfilled`)a.push(...t.value);else{let n=t.reason;console.warn(`[lintpage] Async rule "${r[e].meta.id}" threw an error: ${n instanceof Error?n.message:String(n)}`)}}return a}async function v(e,t,n){let r=e.filter(e=>_(e.meta.id,n)),i=await Promise.allSettled(r.map(e=>e.run(t))),a=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.status===`fulfilled`)a.push(...t.value);else{let n=t.reason;console.warn(`[lintpage] Standalone rule "${r[e].meta.id}" threw an error: ${n instanceof Error?n.message:String(n)}`)}}return a}async function y(e,t){let n=t?.onStep,r=[...o],i=[],a=[];if(t?.plugins)for(let e of t.plugins)r.push(...e.rules),e.asyncRules&&i.push(...e.asyncRules),e.standaloneRules&&a.push(...e.standaloneRules);let s=null,c=0,l=null;try{let t=await p(e,{onStep:n});s={document:t.document,url:e,response:t.response,isHttps:e.startsWith(`https://`)},c=t.ttfbMs}catch(e){let t=e instanceof Error?e.message:String(e),n=/Failed to fetch URL: (\d{3})/.exec(t);l={message:t,statusCode:n?Number(n[1]):void 0}}let u=r.length+i.length+a.length;n?.({step:`rules`,status:`start`,count:u});let d=s?ee(r,s,t?.config):[],f=[];if(s&&i.length>0&&f.push(te(i,s,t?.config)),a.length>0&&f.push(v(a,e,t?.config)),f.length>0){let e=await Promise.all(f);for(let t of e)d.push(...t)}if(l){let e=l.statusCode,t=e===403||e===429||e===503;d.push({ruleId:`target-unreachable`,ruleName:`Target unreachable to LintPage`,message:t?`Your WAF or CDN blocked our outer probe (HTTP ${e}). DOM-dependent checks were skipped; AI visibility and other standalone checks still ran.`:`LintPage could not fetch the page (${l.message}). DOM-dependent checks were skipped; standalone checks (AI visibility, robots.txt, sitemap) still ran.`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`free`,fix:t?'If you control this site: allow `LintPage/1.0` in your WAF (Cloudflare → Security → Bots → User-Agent rules). The probe UA contains "LintPage/1.0" so you can match on that token. If you don\'t control the site, the partial report below still shows what AI crawlers see.':`Verify the URL is reachable from the public internet and returns 2xx for a Chrome-like User-Agent within 30s.`,data:{statusCode:e,raw:l.message}})}c>1800?d.push({ruleId:`ttfb`,ruleName:`Time to First Byte`,message:`Slow server response time (TTFB: ${c}ms) - aim for under 800ms`,severity:`WARNING`,category:`Performance`,tier:`free`,fix:`Optimize server response time: enable caching, use a CDN, optimize database queries, or upgrade hosting.`,data:{ms:c}}):c>800&&d.push({ruleId:`ttfb`,ruleName:`Time to First Byte`,message:`Server response time could be improved (TTFB: ${c}ms) - aim for under 800ms`,severity:`INFO`,category:`Performance`,tier:`free`,fix:`Consider enabling server-side caching or using a CDN to reduce response time.`,data:{ms:c}}),n?.({step:`rules`,status:`done`,found:d.length});let m=h(d),g=Object.values(m).reduce((e,t)=>e+t.score,0),_=d.some(e=>e.severity===`CRITICAL`&&e.category!==`AI Visibility`),y=d.some(e=>e.severity===`CRITICAL`&&e.category===`AI Visibility`),b=_?`FAIL`:y?`AI-FAIL`:`PASS`;return{url:e,timestamp:new Date().toISOString(),results:d,score:Math.round(g),overallStatus:b,categoryScores:m}}var b=[`.lintpagerc.json`,`.lintpagerc`,`lintpage.config.json`];function ne(e){let t=e||process.cwd();if(e&&(0,i.existsSync)(e)&&(0,i.statSync)(e).isFile())try{let t=(0,i.readFileSync)(e,`utf-8`);return JSON.parse(t)}catch{return null}let n=t;for(let e of b){let t=(0,a.join)(n,e);if((0,i.existsSync)(t))try{let e=(0,i.readFileSync)(t,`utf-8`);return JSON.parse(e)}catch{return null}}return null}function re(){return{rules:{}}}var ie={meta:{id:`ssl`,name:`SSL / HTTPS`,category:`Pre-Launch`,tier:`pro`,description:`Checks that the site is served over HTTPS`},run(e){let t=[];return e.isHttps||t.push({ruleId:`ssl`,ruleName:`SSL / HTTPS`,message:`Site is not using HTTPS - required for SEO and user trust. Search engines penalize HTTP sites.`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Install an SSL certificate and redirect all HTTP traffic to HTTPS. Most hosting providers offer free SSL via Let's Encrypt.`}),t}},ae={meta:{id:`robots-txt-check`,name:`robots.txt Check`,category:`Pre-Launch`,tier:`pro`,description:`Fetches and validates robots.txt for proper directives`},async run(e){let t=[];try{let n=new URL(`/robots.txt`,e).href,r=await fetch(n,{headers:{"User-Agent":`LintPage-Bot/1.0`}});if(!r.ok)return t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`No robots.txt file found - recommended to have one`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Create a robots.txt file at your site root with at least "User-Agent: *" and "Allow: /" directives.`}),t;let i=await r.text(),a=i.split(`
2
+ `).map(e=>e.trim()),o=new Map,s=`*`;for(let e of a){if(!e||e.startsWith(`#`))continue;let[t,...n]=e.split(`:`).map(e=>e.trim()),r=n.join(`:`).trim();if(!t||!r)continue;let i=t.toUpperCase();if(i===`USER-AGENT`)s=r,o.has(s)||o.set(s,{disallow:[],allow:[]});else if(i===`DISALLOW`){let e=o.get(s)||{disallow:[],allow:[]};e.disallow.push(r),o.set(s,e)}else if(i===`ALLOW`){let e=o.get(s)||{disallow:[],allow:[]};e.allow.push(r),o.set(s,e)}}let c=o.get(`*`);c&&c.disallow.includes(`/`)&&t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`robots.txt contains "Disallow: /" for User-Agent: * - this blocks ALL search engines from crawling your entire site!`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Change "Disallow: /" to "Allow: /" in your robots.txt, or remove the Disallow directive entirely.`}),i.toLowerCase().includes(`sitemap`)||t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`robots.txt does not reference sitemap.xml - consider adding a Sitemap directive`,severity:`INFO`,category:`Pre-Launch`,tier:`pro`,fix:`Add "Sitemap: https://yoursite.com/sitemap.xml" to the end of your robots.txt file.`}),a.some(e=>!e||e.startsWith(`#`)?!1:!e.includes(`:`)&&e.length>0)&&t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`robots.txt may have syntax errors - ensure each directive follows "Directive: value" format`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Review each line in robots.txt. Every directive must follow the "Directive: value" format (e.g., "User-Agent: *").`}),(o.size===0||o.size===1&&!o.has(`*`))&&t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`robots.txt exists but has no rules defined - add User-Agent and Disallow/Allow directives`,severity:`INFO`,category:`Pre-Launch`,tier:`pro`,fix:`Add at minimum "User-Agent: *" followed by "Allow: /" to your robots.txt.`})}catch{t.push({ruleId:`robots-txt-check`,ruleName:`robots.txt Check`,message:`Could not fetch robots.txt - ensure it exists at root domain`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Create a robots.txt file at your domain root (e.g., https://yoursite.com/robots.txt).`})}return t}},oe={meta:{id:`sitemap-presence`,name:`Sitemap Presence`,category:`Pre-Launch`,tier:`pro`,description:`Checks for the existence and validity of sitemap.xml`},async run(e){let t=[];try{let n=new URL(`/sitemap.xml`,e).href,r=await fetch(n,{headers:{"User-Agent":`LintPage-Bot/1.0`}});if(!r.ok)return t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`No sitemap.xml found - recommended for search engines to discover your pages`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Generate a sitemap.xml and place it at your domain root. Most frameworks (Next.js, WordPress) have built-in sitemap generation.`}),t;let i=await r.text(),a=i.includes(`<urlset`),o=i.includes(`<sitemapindex`);if((!i.includes(`<?xml`)||!a&&!o)&&t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`sitemap.xml exists but may not be valid XML format`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Ensure your sitemap.xml starts with <?xml version="1.0"?> and uses the <urlset> or <sitemapindex> element with proper namespace.`}),o){let e=i.match(/<sitemap>/g);return(!e||e.length===0)&&t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`Sitemap index file is empty - add child sitemap references`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Add <sitemap><loc>https://yoursite.com/sitemap-pages.xml</loc></sitemap> entries to your sitemap index.`}),t}let s=i.match(/<loc>/g);(s?s.length:0)===0&&t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`sitemap.xml is empty - add URLs to help search engines discover content`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Add <url><loc>https://yoursite.com/page</loc></url> entries to your sitemap for each page you want indexed.`})}catch{t.push({ruleId:`sitemap-presence`,ruleName:`Sitemap Presence`,message:`Could not fetch sitemap.xml - create one at /sitemap.xml`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Create a sitemap.xml at your domain root. Use a sitemap generator or your framework's built-in sitemap feature.`})}return t}},se={meta:{id:`tracking`,name:`Analytics Tracking`,category:`Pre-Launch`,tier:`pro`,description:`Checks for Google Analytics, Google Tag Manager, or Facebook Pixel`},run(e){let{document:t}=e,n=[],r=!1,i=t.querySelectorAll(`script`),a=t.documentElement?.outerHTML||``;return i.forEach(e=>{let t=e.getAttribute(`src`)||``,n=e.textContent||``;(t.includes(`googletagmanager.com/gtag/js`)||n.includes(`gtag(`))&&(r=!0),(t.includes(`googletagmanager.com/gtm.js`)||n.includes(`GTM-`))&&(r=!0),t.includes(`plausible.io/js/`)&&(r=!0),(t.includes(`usefathom.com/script.js`)||t.includes(`cdn.usefathom.com`))&&(r=!0),(t.includes(`matomo.js`)||t.includes(`matomo.php`)||t.includes(`piwik.js`))&&(r=!0),(t.includes(`posthog-js`)||t.includes(`i.posthog.com`))&&(r=!0),(t.includes(`cdn.mxpnl.com`)||t.includes(`mixpanel.com`))&&(r=!0),(t.includes(`va.vercel-scripts.com`)||t.includes(`vitals.vercel-insights.com`))&&(r=!0),t.includes(`static.cloudflareinsights.com`)&&(r=!0),(t.includes(`umami.js`)||t.includes(`umami.is/script.js`))&&(r=!0),t.includes(`clarity.ms/tag`)&&(r=!0)}),!r&&(a.includes(`@vercel/analytics`)||a.includes(`vercel-analytics`))&&(r=!0),r||n.push({ruleId:`tracking`,ruleName:`Analytics Tracking`,message:`No analytics tracking found - you won't be able to measure traffic after launch`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Add an analytics solution to your site. Options include Google Analytics, Plausible, Fathom, Matomo, PostHog, Vercel Analytics, Umami, or Cloudflare Web Analytics.`,data:{foundAnalytics:r}}),n}},ce={meta:{id:`x-robots-tag`,name:`X-Robots-Tag Header`,category:`Pre-Launch`,tier:`pro`,description:`Checks the X-Robots-Tag HTTP header for noindex/nofollow`},run(e){let{response:t}=e,n=[],r=t.headers.get(`x-robots-tag`);if(!r)return n;let i=r.toLowerCase();return i.includes(`noindex`)&&n.push({ruleId:`x-robots-tag`,ruleName:`X-Robots-Tag Header`,message:`X-Robots-Tag HTTP header contains "noindex" - page will NOT be indexed by search engines!`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Remove the X-Robots-Tag header from your server configuration, or change its value to "index, follow".`,data:{value:r}}),i.includes(`nofollow`)&&n.push({ruleId:`x-robots-tag`,ruleName:`X-Robots-Tag Header`,message:`X-Robots-Tag HTTP header contains "nofollow" - links will not be followed by search engines`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove "nofollow" from the X-Robots-Tag header if you want search engines to follow your links.`,data:{value:r}}),n}},le={meta:{id:`thin-content`,name:`Thin Content`,category:`SEO`,tier:`pro`,description:`Checks that the page has sufficient text content for search engines`},run(e){let{document:t}=e,n=[],r=(t.body?.textContent||``).trim().split(/\s+/).filter(Boolean).length;return r<300&&n.push({ruleId:`thin-content`,ruleName:`Thin Content`,message:`Page has thin content (${r} words) - search engines prefer pages with substantial content (300+ words)`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add more meaningful text content to the page. Search engines rank pages with substantial, relevant content higher.`,data:{wordCount:r}}),n}},ue={meta:{id:`duplicate-meta`,name:`Duplicate Meta Tags`,category:`SEO`,tier:`pro`,description:`Checks for duplicate title, meta description, and canonical tags`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`title`);r.length>1&&n.push({ruleId:`duplicate-meta`,ruleName:`Duplicate Meta Tags`,message:`Found ${r.length} <title> tags - should have exactly one`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove duplicate <title> tags. Keep only one in your <head> element.`,data:{count:r.length,tag:`title`}});let i=t.querySelectorAll(`meta[name="description"]`);i.length>1&&n.push({ruleId:`duplicate-meta`,ruleName:`Duplicate Meta Tags`,message:`Found ${i.length} meta description tags - should have exactly one`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove duplicate <meta name="description"> tags. Keep only one in your <head> element.`,data:{count:i.length,tag:`meta-description`}});let a=t.querySelectorAll(`link[rel="canonical"]`);return a.length>1&&n.push({ruleId:`duplicate-meta`,ruleName:`Duplicate Meta Tags`,message:`Found ${a.length} canonical link tags - should have exactly one`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove duplicate <link rel="canonical"> tags. Keep only one in your <head> element.`,data:{count:a.length,tag:`canonical`}}),n}},de={meta:{id:`structured-data`,name:`Structured Data`,category:`SEO`,tier:`pro`,description:`Checks for the presence and validity of JSON-LD structured data`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`script[type="application/ld+json"]`),i=[];return r.forEach(e=>{try{let t=JSON.parse(e.textContent||``);if(Array.isArray(t[`@graph`]))for(let e of t[`@graph`])e[`@type`]&&i.push(e[`@type`]);else t[`@type`]&&i.push(t[`@type`])}catch{n.push({ruleId:`structured-data`,ruleName:`Structured Data`,message:`Invalid JSON-LD structured data found`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Validate your JSON-LD using Google's Rich Results Test tool and fix any JSON syntax errors.`})}}),i.length===0&&n.push({ruleId:`structured-data`,ruleName:`Structured Data`,message:`No structured data (JSON-LD) found`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add a <script type="application/ld+json"> block with Organization, WebPage, or other relevant schema.org types.`,data:{types:i}}),n}},fe={meta:{id:`charset`,name:`Character Encoding`,category:`SEO`,tier:`pro`,description:`Checks for a proper charset/encoding declaration`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[charset]`),i=t.querySelector(`meta[http-equiv="Content-Type"]`);return!r&&!i&&n.push({ruleId:`charset`,ruleName:`Character Encoding`,message:`Missing character encoding declaration - may cause rendering issues with special characters`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <meta charset="utf-8" /> as the first element in your <head> tag.`}),n}},pe={meta:{id:`image-alt-text`,name:`Image Alt Text`,category:`Accessibility`,tier:`pro`,description:`Checks that all images have alt attributes`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`img`),i=0;return r.forEach(e=>{e.getAttribute(`alt`)??i++}),i>0&&n.push({ruleId:`image-alt-text`,ruleName:`Image Alt Text`,message:`${i} of ${r.length} images missing alt attributes`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Add descriptive alt attributes to all images. Screen readers use alt text to describe images to visually impaired users. Use alt="" for decorative images.`,data:{total:r.length,missingAlt:i}}),n}},me={meta:{id:`accessibility`,name:`Accessibility & ARIA`,category:`Accessibility`,tier:`pro`,description:`Checks buttons, links, inputs, and ARIA attributes for accessibility`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`button`),i=0;r.forEach(e=>{let t=e.textContent?.trim(),n=e.getAttribute(`aria-label`),r=e.getAttribute(`aria-labelledby`);!t&&!n&&!r&&i++}),i>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${i} button(s) missing accessible name (no text, aria-label, or aria-labelledby)`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Add visible text content, an aria-label, or aria-labelledby attribute to each button.`,data:{inaccessibleButtons:i}});let a=t.querySelectorAll(`a`),o=0;a.forEach(e=>{let t=e.textContent?.trim(),n=e.getAttribute(`aria-label`),r=e.getAttribute(`aria-labelledby`);!t&&!n&&!r&&o++}),o>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${o} link(s) missing accessible name (no text, aria-label, or aria-labelledby)`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Add descriptive text content, an aria-label, or aria-labelledby attribute to each link so screen readers can identify it.`,data:{inaccessibleLinks:o}});let s=t.querySelectorAll(`input:not([type='hidden'])`),c=0;s.forEach(e=>{let n=e.getAttribute(`id`),r=e.getAttribute(`aria-label`),i=e.getAttribute(`aria-labelledby`),a=e.getAttribute(`title`),o=n&&t.querySelector(`label[for="${n}"]`),s=e.closest(`label`)!==null;!o&&!s&&!r&&!i&&!a&&c++}),c>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${c} input(s) missing associated label`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Add a <label for="inputId"> element, or add an aria-label attribute to each input.`,data:{unlabeledInputs:c}});let l=t.querySelectorAll(`div[onclick], span[onclick]`),u=0;l.forEach(e=>{e.getAttribute(`role`)||u++}),u>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${u} interactive div/span element(s) missing role attribute`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Use a <button> element instead, or add role="button" and an aria-label to interactive elements.`,data:{missingRoles:u}});let d=t.querySelectorAll(`nav, [role="navigation"]`),f=0;return d.forEach(e=>{let t=e.getAttribute(`aria-label`),n=e.getAttribute(`aria-labelledby`);!t&&!n&&f++}),f>0&&n.push({ruleId:`accessibility`,ruleName:`Accessibility & ARIA`,message:`${f} navigation element(s) missing aria-label or aria-labelledby`,severity:`INFO`,category:`Accessibility`,tier:`pro`,fix:`Add aria-label="Main navigation" (or similar descriptive label) to your <nav> elements.`,data:{unlabeledNav:f}}),n}},he={meta:{id:`semantic-structure`,name:`Semantic Structure`,category:`Accessibility`,tier:`pro`,description:`Checks for proper semantic HTML: landmarks, lists, tables, articles`},run(e){let{document:t}=e,n=[];t.querySelector(`main`)||n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`Missing <main> element - should wrap primary page content for better structure`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Wrap your primary page content in a <main> element. There should be exactly one per page.`}),t.querySelectorAll(`main, section, article, aside, nav`).length===0&&n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`Missing semantic page regions - use <main>, <section>, <article>, <nav>, <aside> instead of generic divs`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Replace generic <div> containers with semantic elements: <main>, <nav>, <section>, <article>, <aside>.`});let r=t.querySelectorAll(`li`),i=0;r.forEach(e=>{let t=e.parentElement;t?.tagName!==`UL`&&t?.tagName!==`OL`&&i++}),i>0&&n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`${i} <li> element(s) found outside of <ul> or <ol> - breaks semantic structure`,severity:`WARNING`,category:`Accessibility`,tier:`pro`,fix:`Wrap <li> elements inside a <ul> (unordered) or <ol> (ordered) list element.`,data:{orphanedLi:i}});let a=t.querySelectorAll(`table`),o=0;a.forEach(e=>{e.querySelector(`th`)||o++}),o>0&&n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`${o} table(s) missing <th> header cells`,severity:`INFO`,category:`Accessibility`,tier:`pro`,fix:`Add <th> cells to define table column or row headers. Optionally wrap them in a <thead> element for additional structure.`,data:{tablesWithoutHeaders:o}});let s=t.querySelectorAll(`article`),c=0;return s.forEach(e=>{e.querySelector(`h1, h2, h3, h4, h5, h6`)||c++}),c>0&&n.push({ruleId:`semantic-structure`,ruleName:`Semantic Structure`,message:`${c} <article> element(s) without a heading`,severity:`INFO`,category:`Accessibility`,tier:`pro`,fix:`Add a heading (h2-h6) inside each <article> element to provide context.`,data:{articlesWithoutHeading:c}}),n}},ge={meta:{id:`performance`,name:`Performance Hints`,category:`Performance`,tier:`pro`,description:`Checks for inline styles, lazy loading, and script count`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`img`),i=Array.from(r).slice(3),a=0;i.forEach(e=>{e.getAttribute(`loading`)||a++}),a>0&&n.push({ruleId:`performance`,ruleName:`Performance Hints`,message:`${a} below-the-fold image(s) without loading="lazy" - add lazy loading to defer offscreen images`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Add loading="lazy" to images below the fold. Do NOT add loading="lazy" to above-the-fold or LCP images - this hurts performance (per web.dev).`,data:{noLazyLoad:a,totalImages:r.length}});let o=t.querySelectorAll(`script[src]`);return o.length>10&&n.push({ruleId:`performance`,ruleName:`Performance Hints`,message:`Consider reducing external scripts (${o.length} found) for better performance`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Audit your scripts and remove unused ones. Consider bundling or deferring non-critical scripts.`,data:{scriptCount:o.length}}),n}},_e={meta:{id:`image-dimensions`,name:`Image Dimensions`,category:`Performance`,tier:`pro`,description:`Checks that images have explicit width and height to prevent layout shift (CLS)`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`img`),i=0;return r.forEach(e=>{let t=e.getAttribute(`width`),n=e.getAttribute(`height`);(!t||!n)&&i++}),i>0&&n.push({ruleId:`image-dimensions`,ruleName:`Image Dimensions`,message:`${i} image${i===1?``:`s`} missing explicit width/height attributes - causes layout shift (CLS)`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Add width and height attributes to <img> tags to reserve space and prevent layout shift.`,data:{missingCount:i,totalImages:r.length}}),n}},ve={meta:{id:`ttfb-pro`,name:`Time to First Byte (Pro)`,category:`Performance`,tier:`pro`,description:`Measures server response time (TTFB) with detailed thresholds`},async run(e){let t=[];try{let n=Date.now();await fetch(e,{headers:{"User-Agent":`LintPage-Bot/1.0`}});let r=Date.now()-n;r>1800?t.push({ruleId:`ttfb-pro`,ruleName:`Time to First Byte (Pro)`,message:`Slow server response time (TTFB: ${r}ms) - aim for under 800ms`,severity:`WARNING`,category:`Performance`,tier:`pro`,fix:`Optimize server response time: enable caching, use a CDN, optimize database queries, or upgrade hosting.`,data:{ms:r}}):r>800&&t.push({ruleId:`ttfb-pro`,ruleName:`Time to First Byte (Pro)`,message:`Server response time could be improved (TTFB: ${r}ms) - aim for under 800ms`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Consider enabling server-side caching or using a CDN to reduce response time.`,data:{ms:r}})}catch{t.push({ruleId:`ttfb-pro`,ruleName:`Time to First Byte (Pro)`,message:`Could not measure TTFB - server may be unreachable`,severity:`WARNING`,category:`Performance`,tier:`pro`,fix:`Ensure your server is accessible and responding to requests.`})}return t}},ye={meta:{id:`mixed-content`,name:`Mixed Content`,category:`Pre-Launch`,tier:`pro`,description:`Checks for HTTP resources loaded on an HTTPS page (mixed content)`},run(e){let{document:t,isHttps:n}=e,r=[];if(!n)return r;let i=[`img[src^="http:"]`,`script[src^="http:"]`,`link[href^="http:"]`,`iframe[src^="http:"]`,`video[src^="http:"]`,`audio[src^="http:"]`,`object[data^="http:"]`,`source[src^="http:"]`],a=0;return i.forEach(e=>{a+=t.querySelectorAll(e).length}),a>0&&r.push({ruleId:`mixed-content`,ruleName:`Mixed Content`,message:`Found ${a} mixed content resource${a===1?``:`s`} (HTTP on HTTPS page) - browsers may block these`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Change all resource URLs from http:// to https:// or use protocol-relative URLs (//).`,data:{count:a}}),r}},be={meta:{id:`security-headers`,name:`Security Headers`,category:`Pre-Launch`,tier:`pro`,description:`Checks for important security headers (CSP, HSTS, X-Content-Type-Options, Permissions-Policy)`},run(e){let{response:t}=e,n=[],r=[{name:`content-security-policy`,label:`Content-Security-Policy`},{name:`strict-transport-security`,label:`Strict-Transport-Security (HSTS)`},{name:`x-content-type-options`,label:`X-Content-Type-Options`},{name:`permissions-policy`,label:`Permissions-Policy`}],i=[];return r.forEach(({name:e,label:n})=>{t.headers.get(e)||i.push(n)}),i.length>0&&n.push({ruleId:`security-headers`,ruleName:`Security Headers`,message:`Missing security headers: ${i.join(`, `)}`,severity:`INFO`,category:`Pre-Launch`,tier:`pro`,fix:`Configure your server or hosting provider to send these security headers. Most can be set in next.config.js headers() or your CDN settings.`,data:{missing:i}}),n}},xe={meta:{id:`og-image-size`,name:`OG Image Size`,category:`SEO`,tier:`pro`,description:`Checks that the og:image URL exists and advises on recommended dimensions (1200x630)`},run(e){let{document:t}=e,n=[];if(!t.querySelector(`meta[property="og:image"]`)?.getAttribute(`content`)?.trim())return n;let r=t.querySelector(`meta[property="og:image:width"]`),i=t.querySelector(`meta[property="og:image:height"]`),a=Number.parseInt(r?.getAttribute(`content`)||``,10),o=Number.parseInt(i?.getAttribute(`content`)||``,10);return!r||!i||Number.isNaN(a)||Number.isNaN(o)?(n.push({ruleId:`og-image-size`,ruleName:`OG Image Size`,message:`Missing og:image:width and og:image:height meta tags - social platforms may crop your image incorrectly`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <meta property="og:image:width" content="1200" /> and <meta property="og:image:height" content="630" /> to your <head>.`}),n):((a<1200||o<630)&&n.push({ruleId:`og-image-size`,ruleName:`OG Image Size`,message:`OG image dimensions (${a}x${o}) are below recommended 1200x630 - may appear blurry on social platforms`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Use an image at least 1200x630 pixels for best display on Facebook, LinkedIn, and other social platforms.`,data:{width:a,height:o}}),n)}},x=new Set([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),S=new Set([`.jpg`,`.jpeg`,`.png`,`.gif`,`.webp`]),C={meta:{id:`og-image-type`,name:`OG Image Type`,category:`SEO`,tier:`pro`,description:`Checks that the og:image type is a widely-supported format (JPEG, PNG, GIF, WebP)`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[property="og:image"]`)?.getAttribute(`content`)?.trim();if(!r)return n;let i=t.querySelector(`meta[property="og:image:type"]`)?.getAttribute(`content`)?.trim();if(i&&!x.has(i.toLowerCase()))return n.push({ruleId:`og-image-type`,ruleName:`OG Image Type`,message:`OG image type "${i}" may not be supported by all social platforms`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Use JPEG or PNG for og:image. These formats are supported by all social platforms.`,data:{type:i}}),n;if(!i)try{let e=new URL(r,`https://example.com`),t=e.pathname.substring(e.pathname.lastIndexOf(`.`)).toLowerCase();t&&!S.has(t)&&n.push({ruleId:`og-image-type`,ruleName:`OG Image Type`,message:`OG image URL has extension "${t}" which may not be supported by all social platforms`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Use JPEG or PNG for og:image, and add <meta property="og:image:type" content="image/jpeg" /> to your <head>.`,data:{extension:t}})}catch{}return n}},w={meta:{id:`twitter-image`,name:`Twitter/X Image`,category:`SEO`,tier:`pro`,description:`Checks for twitter:image meta tag for rich card previews on X/Twitter`},run(e){let{document:t}=e,n=[];if(!t.querySelector(`meta[name="twitter:card"]`))return n;let r=t.querySelector(`meta[name="twitter:image"]`),i=t.querySelector(`meta[property="og:image"]`);return!r&&!i?n.push({ruleId:`twitter-image`,ruleName:`Twitter/X Image`,message:`Twitter card present but no twitter:image or og:image found - tweets will have no image preview`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <meta name="twitter:image" content="https://yoursite.com/image.png" /> to your <head>.`}):!r&&i&&n.push({ruleId:`twitter-image`,ruleName:`Twitter/X Image`,message:`No explicit twitter:image - falling back to og:image. Consider adding twitter:image for optimal display.`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add <meta name="twitter:image" content="..." /> for more control over how your image appears on X/Twitter.`}),n}},T={meta:{id:`social-preview-render`,name:`Social Preview Completeness`,category:`SEO`,tier:`pro`,description:`Checks that all essential meta tags for social sharing previews are present and consistent`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[property="og:title"]`)?.getAttribute(`content`),i=t.querySelector(`meta[property="og:description"]`)?.getAttribute(`content`),a=t.querySelector(`meta[property="og:image"]`)?.getAttribute(`content`),o=t.querySelector(`meta[property="og:url"]`)?.getAttribute(`content`),s=t.querySelector(`meta[property="og:type"]`)?.getAttribute(`content`),c=t.querySelector(`title`)?.textContent?.trim();return t.querySelector(`meta[name="description"]`)?.getAttribute(`content`),s||n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`Missing og:type meta tag - required by the Open Graph protocol and needed for correct social preview rendering`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <meta property="og:type" content="website" /> (or "article" for blog posts) to your <head>. This is a required property per the Open Graph protocol.`}),a&&a.trim()&&(t.querySelector(`meta[property="og:image:alt"]`)?.getAttribute(`content`)||n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`Missing og:image:alt - the Open Graph protocol recommends providing alt text when og:image is set`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add <meta property="og:image:alt" content="Description of the image" /> to your <head> for accessibility.`})),r&&c&&r.length>0&&c.length>0&&r.length>60&&n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`og:title is ${r.length} characters - may be truncated on social platforms (recommended: 50-60)`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Keep og:title under 60 characters for best display on social platforms.`,data:{ogTitleLength:r.length}}),i&&i.length>200&&n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`og:description is ${i.length} characters - may be truncated on social platforms (recommended: under 200)`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Keep og:description under 200 characters for best display on social platforms.`,data:{ogDescLength:i.length}}),o&&!o.startsWith(`http`)&&n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`og:url should be an absolute URL starting with https://`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Change og:url to an absolute URL (e.g., https://yoursite.com/page).`}),a&&!a.startsWith(`http`)&&n.push({ruleId:`social-preview-render`,ruleName:`Social Preview Completeness`,message:`og:image should be an absolute URL starting with https://`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Change og:image to an absolute URL (e.g., https://yoursite.com/image.png).`}),n}},E={meta:{id:`title-keyword-stuffing`,name:`Title Keyword Stuffing`,category:`SEO`,tier:`pro`,description:`Detects potential keyword stuffing in the page title`},run(e){let{document:t}=e,n=[],r=t.querySelector(`title`)?.textContent?.trim();if(!r)return n;let i=r.toLowerCase().split(/[\s\-|:,]+/).filter(e=>e.length>3),a=new Map;for(let e of i)a.set(e,(a.get(e)||0)+1);let o=[];for(let[e,t]of a)t>=3&&o.push(`"${e}" (${t}x)`);o.length>0&&n.push({ruleId:`title-keyword-stuffing`,ruleName:`Title Keyword Stuffing`,message:`Potential keyword stuffing in title: ${o.join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Write a natural, readable title. Avoid repeating the same keyword more than twice. Search engines may penalize keyword stuffing.`,data:{title:r,stuffedWords:o}});let s=(r.match(/[|–—]/g)||[]).length;return s>=3&&n.push({ruleId:`title-keyword-stuffing`,ruleName:`Title Keyword Stuffing`,message:`Title has ${s} separators - may appear spammy to search engines`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Simplify your title. Use at most one separator (|, – or —) to separate the page name from your brand.`,data:{separatorCount:s}}),n}},D={meta:{id:`content-to-html-ratio`,name:`Content-to-HTML Ratio`,category:`SEO`,tier:`pro`,description:`Checks the ratio of visible text to total HTML markup`},run(e){let{document:t}=e,n=[],r=t.documentElement?.outerHTML?.length||0;if(r===0)return n;let i=(t.body?.textContent||``).replace(/\s+/g,` `).trim().length,a=Math.round(i/r*100);return a<10?n.push({ruleId:`content-to-html-ratio`,ruleName:`Content-to-HTML Ratio`,message:`Low content-to-HTML ratio (${a}%) - may indicate excessive markup or thin content`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Increase meaningful text content or reduce unnecessary HTML markup. Note: content-to-HTML ratio is not a direct ranking factor per Google, but correlates with page speed and code quality.`,data:{ratio:a,textLength:i,htmlLength:r}}):a<20&&n.push({ruleId:`content-to-html-ratio`,ruleName:`Content-to-HTML Ratio`,message:`Content-to-HTML ratio is ${a}% - could be improved (aim for 25%+)`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Consider adding more text content or reducing unnecessary HTML markup to improve the ratio.`,data:{ratio:a,textLength:i,htmlLength:r}}),n}},O={meta:{id:`title-uniqueness`,name:`Title Uniqueness`,category:`SEO`,tier:`pro`,description:`Flags titles that appear generic or auto-generated (single-page heuristic)`},run(e){let{document:t,url:n}=e,r=[],i=t.querySelector(`title`)?.textContent?.trim();if(!i)return r;for(let e of[/^home$/i,/^untitled/i,/^page \d+$/i,/^welcome$/i,/^index$/i,/^document$/i,/^my site$/i,/^my website$/i,/^website$/i,/^new page$/i])if(e.test(i)){r.push({ruleId:`title-uniqueness`,ruleName:`Title Uniqueness`,message:`Title "${i}" appears to be a generic/default title - use a unique, descriptive title`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Write a unique, descriptive title for each page that includes your target keyword.`,data:{title:i}});break}try{let e=new URL(n).hostname.replace(`www.`,``),t=e.split(`.`)[0];t&&i.toLowerCase()===t.toLowerCase()&&r.push({ruleId:`title-uniqueness`,ruleName:`Title Uniqueness`,message:`Title is just the domain name - add a descriptive page-specific title`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Include a page-specific description in your title, e.g., "Product Name — Your Brand".`,data:{title:i,hostname:e}})}catch{}return r}},k={meta:{id:`description-uniqueness`,name:`Description Uniqueness`,category:`SEO`,tier:`pro`,description:`Flags meta descriptions that appear generic or auto-generated (single-page heuristic)`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[name="description"]`)?.getAttribute(`content`)?.trim();if(!r)return n;for(let e of[/^welcome to/i,/^this is a website/i,/^a website about/i,/^home page/i,/^we are a company/i,/^default description/i])if(e.test(r)){n.push({ruleId:`description-uniqueness`,ruleName:`Description Uniqueness`,message:`Meta description appears generic - write a unique, compelling description for this page`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Write a unique meta description for each page that summarizes the specific content and includes a call to action.`,data:{description:r}});break}let i=t.querySelector(`title`)?.textContent?.trim();return i&&r.toLowerCase()===i.toLowerCase()&&n.push({ruleId:`description-uniqueness`,ruleName:`Description Uniqueness`,message:`Meta description is identical to the title - they should be different and complementary`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Write a meta description that expands on your title with more detail, a value proposition, or a call to action.`,data:{description:r,title:i}}),n}},A={Organization:[`name`,`url`],WebSite:[`name`,`url`],WebPage:[`name`],BreadcrumbList:[`itemListElement`],LocalBusiness:[`name`,`address`]},j={Article:[`headline`,`author`,`datePublished`],Product:[`name`,`image`,`offers`]};function M(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function N(e,t,n){let r=M(e[`@type`]);if(r.length===0){n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`JSON-LD block missing @type property`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add an @type property (e.g., "Organization", "WebPage", "Article") to your JSON-LD.`});return}let i=r.join(`, `);e[`@context`]||t||n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`JSON-LD "${i}" missing @context - should be "https://schema.org"`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add "@context": "https://schema.org" to your JSON-LD block.`,data:{type:i}});for(let t of r){let r=A[t];if(r){let i=r.filter(t=>!e[t]);i.length>0&&n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`JSON-LD "${t}" missing required fields: ${i.join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add the missing fields to your ${t} schema: ${i.join(`, `)}.`,data:{type:t,missing:i}})}let i=j[t];if(i){let r=i.filter(t=>!e[t]);r.length>0&&n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`JSON-LD "${t}" missing recommended fields: ${r.join(`, `)}`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Add the recommended fields to your ${t} schema for richer search results: ${r.join(`, `)}.`,data:{type:t,missing:r}})}}r.includes(`FAQPage`)&&n.push({ruleId:`structured-data-validate`,ruleName:`Structured Data Validation`,message:`FAQPage rich results are only shown for well-known, authoritative government and health websites. For all other sites, this rich result will no longer be shown regularly`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`You can keep or remove this markup. Unused structured data does not cause problems for Search, but it also has no visible effects in Google Search. Consider using other structured data types that still produce rich results for your site type.`,data:{type:`FAQPage`}})}var Se={meta:{id:`structured-data-validate`,name:`Structured Data Validation`,category:`SEO`,tier:`pro`,description:`Validates JSON-LD structured data for required fields based on schema type`},run(e){let{document:t}=e,n=[];return t.querySelectorAll(`script[type="application/ld+json"]`).forEach(e=>{let t;try{t=JSON.parse(e.textContent||``)}catch{return}if(Array.isArray(t[`@graph`])){let e=t[`@context`];for(let r of t[`@graph`])N(r,e,n);return}N(t,void 0,n)}),n}},Ce={meta:{id:`hreflang`,name:`Hreflang Tags`,category:`SEO`,tier:`pro`,description:`Validates hreflang tags for multi-language pages`},run(e){let{document:t,url:n}=e,r=[],i=t.querySelectorAll(`link[rel="alternate"][hreflang]`);if(i.length===0)return r;Array.from(i).some(e=>e.getAttribute(`hreflang`)===`x-default`)||r.push({ruleId:`hreflang`,ruleName:`Hreflang Tags`,message:`Hreflang tags found but missing x-default - add a fallback for unmatched languages`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add <link rel="alternate" hreflang="x-default" href="..." /> to specify the default/fallback page.`}),Array.from(i).some(e=>{let t=e.getAttribute(`href`);return t===n||t===n.replace(/\/$/,``)})||r.push({ruleId:`hreflang`,ruleName:`Hreflang Tags`,message:`Hreflang tags do not include a self-referencing tag for the current page`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Add a hreflang tag that points to the current page URL with the appropriate language code.`});let a=/^[a-z]{2}(-[A-Z]{2})?$/;return i.forEach(e=>{let t=e.getAttribute(`hreflang`);t&&t!==`x-default`&&!a.test(t)&&r.push({ruleId:`hreflang`,ruleName:`Hreflang Tags`,message:`Invalid hreflang language code "${t}" - use ISO 639-1 format (e.g., "en", "en-US")`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Change "${t}" to a valid ISO 639-1 language code (e.g., "en", "fr", "de-AT").`,data:{invalidLang:t}});let n=e.getAttribute(`href`);n&&!n.startsWith(`http`)&&r.push({ruleId:`hreflang`,ruleName:`Hreflang Tags`,message:`Hreflang href should be an absolute URL (found: "${n}")`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Use absolute URLs (starting with https://) for all hreflang href attributes.`})}),r}},we={meta:{id:`canonical-self-referencing`,name:`Canonical Self-Referencing`,category:`SEO`,tier:`pro`,description:`Checks that the canonical URL points to the current page (self-referencing canonical)`},run(e){let{document:t,url:n}=e,r=[],i=t.querySelector(`link[rel="canonical"]`);if(!i)return r;let a=i.getAttribute(`href`)?.trim();if(!a)return r;let o=e=>{try{return new URL(e).href.replace(/\/$/,``)}catch{return e.replace(/\/$/,``)}};try{let e=new URL(a,n).href;o(e)!==o(n)&&(new URL(e).hostname===new URL(n).hostname?r.push({ruleId:`canonical-self-referencing`,ruleName:`Canonical Self-Referencing`,message:`Canonical URL points to a different page on the same site - this tells search engines to index "${e}" instead of this page`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`If this page should be indexed, change the canonical to point to itself. If this is intentional (e.g., pagination), you can ignore this.`,data:{canonical:e,pageUrl:n}}):r.push({ruleId:`canonical-self-referencing`,ruleName:`Canonical Self-Referencing`,message:`Canonical URL points to a different domain ("${new URL(e).hostname}") - this is unusual and may be a misconfiguration`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Cross-domain canonical tags are rarely correct. Verify this is intentional, otherwise change the canonical to point to this page.`,data:{canonical:e,pageUrl:n}}))}catch{r.push({ruleId:`canonical-self-referencing`,ruleName:`Canonical Self-Referencing`,message:`Cannot parse canonical URL "${a}" - ensure it's a valid absolute URL`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Use a valid absolute URL for your canonical tag (e.g., https://yoursite.com/page).`})}return r}},Te={meta:{id:`meta-render-blocking`,name:`Render-Blocking Resources`,category:`Performance`,tier:`pro`,description:`Checks for render-blocking stylesheets and synchronous scripts in the <head>`},run(e){let{document:t}=e,n=[],r=t.querySelector(`head`);if(!r)return n;let i=r.querySelectorAll(`script[src]`),a=0;i.forEach(e=>{let t=e.hasAttribute(`async`),n=e.hasAttribute(`defer`),r=e.getAttribute(`type`);!t&&!n&&r!==`module`&&a++}),a>0&&n.push({ruleId:`meta-render-blocking`,ruleName:`Render-Blocking Resources`,message:`${a} synchronous script(s) in <head> may block page rendering`,severity:`WARNING`,category:`Performance`,tier:`pro`,fix:`Add async or defer attributes to non-critical scripts in the <head>, or move them to the end of <body>.`,data:{blockingScripts:a}});let o=r.querySelectorAll(`link[rel="stylesheet"]`),s=0;return o.forEach(e=>{let t=e.getAttribute(`media`);(!t||t===`all`)&&s++}),s>3&&n.push({ruleId:`meta-render-blocking`,ruleName:`Render-Blocking Resources`,message:`${s} render-blocking stylesheets in <head> - consider inlining critical CSS`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Inline critical CSS and load non-critical stylesheets asynchronously using media="print" with an onload handler.`,data:{blockingStylesheets:s}}),n}},Ee={meta:{id:`lazy-load-lcp`,name:`Lazy Load LCP`,category:`Performance`,tier:`pro`,description:`Checks that above-the-fold images (likely LCP candidates) are not lazy-loaded`},run(e){let{document:t}=e,n=[],r=t.querySelectorAll(`img`),i=Array.from(r).slice(0,3);for(let e of i){let t=e.getAttribute(`loading`),r=e.getAttribute(`fetchpriority`);if(t===`lazy`){let t=e.getAttribute(`src`)||``,r=e.getAttribute(`alt`)||``,i=r?`"${r.substring(0,40)}"`:t?`src="${t.substring(0,50)}"`:`first image`;n.push({ruleId:`lazy-load-lcp`,ruleName:`Lazy Load LCP`,message:`Above-the-fold image (${i}) has loading="lazy" - this delays the Largest Contentful Paint`,severity:`WARNING`,category:`Performance`,tier:`pro`,fix:`Remove loading="lazy" from above-the-fold images. Add fetchpriority="high" to the LCP image instead.`});break}if(!r&&!t){n.push({ruleId:`lazy-load-lcp`,ruleName:`Lazy Load LCP`,message:`Consider adding fetchpriority="high" to your hero/banner image to improve Largest Contentful Paint`,severity:`INFO`,category:`Performance`,tier:`pro`,fix:`Add fetchpriority="high" to the most important above-the-fold image to prioritize its loading.`});break}}return n}},De={meta:{id:`https-links`,name:`HTTPS Links`,category:`Pre-Launch`,tier:`pro`,description:`Checks that internal links use HTTPS instead of HTTP`},run(e){let{document:t,url:n}=e,r=[],i;try{i=new URL(n).hostname}catch{return r}let a=t.querySelectorAll(`a[href^="http:"]`),o=0,s=0;return a.forEach(e=>{let t=e.getAttribute(`href`);if(t)try{new URL(t).hostname===i?o++:s++}catch{}}),o>0&&r.push({ruleId:`https-links`,ruleName:`HTTPS Links`,message:`${o} internal link(s) use HTTP instead of HTTPS`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`Change all internal links from http:// to https:// to avoid redirect chains and mixed content warnings.`,data:{internalHttpLinks:o}}),s>0&&r.push({ruleId:`https-links`,ruleName:`HTTPS Links`,message:`${s} external link(s) use HTTP - consider updating to HTTPS where available`,severity:`INFO`,category:`Pre-Launch`,tier:`pro`,fix:`Update external links to use https:// where the destination supports it.`,data:{externalHttpLinks:s}}),r}},Oe={meta:{id:`meta-refresh-redirect`,name:`Meta Refresh Redirect`,category:`SEO`,tier:`pro`,description:`Checks for <meta http-equiv="refresh"> redirects which are bad for SEO`},run(e){let{document:t}=e,n=[],r=t.querySelector(`meta[http-equiv="refresh"]`);if(!r)return n;let i=r.getAttribute(`content`)||``,a=i.toLowerCase().includes(`url=`),o=Number.parseInt(i.split(`;`)[0]||``,10);return a?n.push({ruleId:`meta-refresh-redirect`,ruleName:`Meta Refresh Redirect`,message:`Page uses a meta refresh redirect${Number.isNaN(o)?``:` (${o}s delay)`} - use server-side 301 redirects instead`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Replace <meta http-equiv="refresh"> with a server-side 301 redirect. Meta refreshes are bad for SEO and user experience.`,data:{content:i,delay:Number.isNaN(o)?void 0:o}}):!Number.isNaN(o)&&o>0&&n.push({ruleId:`meta-refresh-redirect`,ruleName:`Meta Refresh Redirect`,message:`Page auto-refreshes every ${o} seconds - this may cause usability issues`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`Consider removing the auto-refresh meta tag unless it serves a clear user need.`,data:{content:i,delay:o}}),n}},ke={meta:{id:`nofollow-audit`,name:`Nofollow Audit`,category:`SEO`,tier:`pro`,description:`Audits the use of rel="nofollow" on internal vs. external links`},run(e){let{document:t,url:n}=e,r=[],i;try{i=new URL(n).hostname}catch{return r}let a=t.querySelectorAll(`a[rel~="nofollow"]`),o=0;return a.forEach(e=>{let t=e.getAttribute(`href`);if(t)try{new URL(t,n).hostname===i&&o++}catch{(t.startsWith(`/`)||t.startsWith(`.`))&&o++}}),o>0&&r.push({ruleId:`nofollow-audit`,ruleName:`Nofollow Audit`,message:`${o} internal link(s) have rel="nofollow" - this wastes PageRank and hurts internal linking`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Remove rel="nofollow" from internal links. Nofollow should only be used for external links you do not want to endorse (e.g., user-generated content, sponsored links).`,data:{internalNofollow:o,totalNofollow:a.length}}),r}},Ae={meta:{id:`cors-policy`,name:`CORS Policy`,category:`Pre-Launch`,tier:`pro`,description:`Checks for overly permissive CORS configuration that could allow unauthorized cross-origin access`},async run(e){let t=[],n=`https://evil.example.com`;try{let r=await fetch(e,{method:`GET`,headers:{"User-Agent":`LintPage-Bot/1.0`,Origin:n},redirect:`follow`}),i=r.headers.get(`access-control-allow-origin`),a=r.headers.get(`access-control-allow-credentials`);if(!i)return t;i===`*`?a?.toLowerCase()===`true`?t.push({ruleId:`cors-policy`,ruleName:`CORS Policy`,message:`CORS allows all origins with credentials enabled - this is a security vulnerability`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Set Access-Control-Allow-Origin to your specific trusted domains instead of "*". Wildcard with credentials is blocked by browsers but indicates a dangerous misconfiguration.`}):t.push({ruleId:`cors-policy`,ruleName:`CORS Policy`,message:`CORS allows all origins (Access-Control-Allow-Origin: *) - restrict to trusted domains in production. Note: some hosting platforms (e.g. Vercel, Netlify, Cloudflare Pages) add this header by default, even if you haven't configured it.`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`If you set this header yourself, configure Access-Control-Allow-Origin to only allow requests from your trusted domains (e.g., "https://myapp.com") instead of using the wildcard "*". If your hosting platform adds it automatically, check their documentation for how to override or restrict CORS headers.`}):i.toLowerCase()===n&&(a?.toLowerCase()===`true`?t.push({ruleId:`cors-policy`,ruleName:`CORS Policy`,message:`CORS reflects any origin with credentials enabled - any website can make authenticated cross-origin requests and read responses. This is the most exploitable CORS misconfiguration.`,severity:`CRITICAL`,category:`Pre-Launch`,tier:`pro`,fix:`Configure your server to validate the Origin header against a strict allowlist of trusted domains. Never reflect arbitrary origins when credentials are enabled.`}):t.push({ruleId:`cors-policy`,ruleName:`CORS Policy`,message:`CORS reflects any origin back in Access-Control-Allow-Origin - this is equivalent to a wildcard and allows any site to make cross-origin requests. Note: this may be caused by your hosting platform or a reverse proxy, not your own configuration.`,severity:`WARNING`,category:`Pre-Launch`,tier:`pro`,fix:`If you set this header yourself, configure your server to validate the Origin header against an allowlist of trusted domains instead of reflecting it back. If your hosting platform adds it automatically, check their documentation for how to override or restrict CORS headers.`}))}catch{}return t}},P=1e4,je={meta:{id:`broken-internal-links`,name:`Broken Internal Links`,category:`SEO`,tier:`pro`,description:`Checks that internal links on the page resolve successfully (no 404s or server errors)`},async run(e){let{document:t,url:n}=e,r=[],i;try{i=new URL(n)}catch{return r}let a=new Set,o=[],s=t.querySelectorAll(`a[href]`);for(let e of s){let t=e.getAttribute(`href`);if(!t||t.startsWith(`#`)||t.startsWith(`mailto:`)||t.startsWith(`tel:`)||t.startsWith(`javascript:`)||t.startsWith(`data:`))continue;let r;try{r=new URL(t,n)}catch{continue}if(r.hostname!==i.hostname)continue;r.hash=``;let s=r.toString();if(a.has(s))continue;a.add(s);let c=new URL(n);c.hash=``,s!==c.toString()&&o.push(s)}if(o.length===0)return r;let c=o.slice(0,50),l=[],u=[],d=async e=>{try{let t=await fetch(e,{method:`HEAD`,headers:{"User-Agent":`LintPage-Bot/1.0`},redirect:`follow`,signal:AbortSignal.timeout(P)});if(t.status===405){let t=await fetch(e,{method:`GET`,headers:{"User-Agent":`LintPage-Bot/1.0`},redirect:`follow`,signal:AbortSignal.timeout(P)});t.status>=400&&l.push({url:e,status:t.status});return}t.status>=400&&l.push({url:e,status:t.status})}catch{u.push(e)}};for(let e=0;e<c.length;e+=10){let t=c.slice(e,e+10);await Promise.all(t.map(d))}if(l.length>0){let e=l.filter(e=>e.status===404),t=l.filter(e=>e.status>=500),n=l.filter(e=>e.status!==404&&e.status<500);e.length>0&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`${e.length} internal link(s) return 404 Not Found: ${e.map(e=>e.url).join(`, `)}`,severity:`CRITICAL`,category:`SEO`,tier:`pro`,fix:`Remove or update the broken links to point to valid pages. Broken internal links hurt SEO and user experience.`,data:{notFoundLinks:e}}),t.length>0&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`${t.length} internal link(s) return server errors: ${t.map(e=>`${e.url} (${e.status})`).join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Investigate server errors on the linked pages. These may indicate temporary issues or misconfigured routes.`,data:{serverErrorLinks:t}}),n.length>0&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`${n.length} internal link(s) return client errors: ${n.map(e=>`${e.url} (${e.status})`).join(`, `)}`,severity:`WARNING`,category:`SEO`,tier:`pro`,fix:`Check the linked pages for access issues (e.g., 401/403 may indicate authentication or permission problems).`,data:{clientErrorLinks:n}})}return u.length>0&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`${u.length} internal link(s) could not be reached: ${u.join(`, `)}`,severity:`INFO`,category:`SEO`,tier:`pro`,fix:`These links timed out or had network errors during the check. Verify they are accessible.`,data:{unreachableLinks:u}}),o.length>50&&r.push({ruleId:`broken-internal-links`,ruleName:`Broken Internal Links`,message:`Only checked 50 of ${o.length} internal links. Consider reducing the number of links on this page.`,severity:`INFO`,category:`SEO`,tier:`pro`,data:{totalLinks:o.length,checkedLinks:50}}),r}},F=`AI Visibility`,I=`pro`,Me=`/blog/ai-crawler-accessibility-guide`,L=`LintPage/1.0 (+https://lintpage.com)`,Ne=5e3,Pe=3600*1e3,R=200,z=[{name:`GPTBot`,userAgent:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.2; +https://openai.com/gptbot`,purpose:`OpenAI training crawler`},{name:`ChatGPT-User`,userAgent:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot`,purpose:`OpenAI live browsing (user-triggered)`},{name:`OAI-SearchBot`,userAgent:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; OAI-SearchBot/1.0; +https://openai.com/searchbot`,purpose:`OpenAI search index`},{name:`ClaudeBot`,userAgent:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ClaudeBot/1.0; +claudebot@anthropic.com`,purpose:`Anthropic training crawler`},{name:`Claude-User`,userAgent:`Mozilla/5.0 (compatible; Claude-User/1.0; +Claude-User@anthropic.com)`,purpose:`Anthropic live browsing (user-triggered)`},{name:`anthropic-ai`,userAgent:`anthropic-ai`,purpose:`Legacy Anthropic UA`},{name:`PerplexityBot`,userAgent:`Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; PerplexityBot/1.0; +https://perplexity.ai/perplexitybot`,purpose:`Perplexity index crawler`},{name:`Perplexity-User`,userAgent:`Mozilla/5.0 (compatible; Perplexity-User/1.0; +https://perplexity.ai/perplexity-user)`,purpose:`Perplexity live browsing (user-triggered)`},{name:`Google-Extended`,userAgent:`Google-Extended`,purpose:`Google AI / Gemini opt-in (robots.txt token)`},{name:`Applebot-Extended`,userAgent:`Applebot-Extended`,purpose:`Apple Intelligence (robots.txt token)`}],B=new Map;async function V(e,t,n=Ne){let r=new AbortController,i=setTimeout(()=>r.abort(),n);try{return await fetch(e,{...t,signal:r.signal})}finally{clearTimeout(i)}}async function Fe(e){try{let t=new URL(`/robots.txt`,e).href,n=await V(t,{headers:{"User-Agent":L}});return n.ok?{fetched:!0,raw:await n.text()}:{fetched:!1,raw:null}}catch{return{fetched:!1,raw:null}}}async function Ie(e){try{let t=new URL(`/llms.txt`,e).href;return{exists:(await V(t,{headers:{"User-Agent":L}})).ok}}catch{return{exists:!1}}}function Le(e){let t=new Map,n=[],r=!1;for(let i of e.split(`
3
+ `)){let e=i.replace(/#.*$/,``).trim();if(!e)continue;let a=e.indexOf(`:`);if(a===-1)continue;let o=e.slice(0,a).trim().toLowerCase(),s=e.slice(a+1).trim();if(o===`user-agent`){r&&=(n=[],!1);let e=s.toLowerCase();n.push(e),t.has(e)||t.set(e,{allow:[],disallow:[]})}else if(o===`disallow`||o===`allow`){r=!0;for(let e of n){let n=t.get(e);n&&(o===`disallow`?n.disallow.push(s):n.allow.push(s))}}}return t}function Re(e,t){if(e===``)return!1;if(e===`/`)return!0;let n=`^`;for(let t of e)t===`*`?n+=`.*`:t===`$`?n+=`$`:n+=t.replace(/[.+?^${}()|[\]\\]/g,`\\$&`);try{return new RegExp(n).test(t)}catch{return!1}}function ze(e,t,n){if(e===null)return`NO_ROBOTS_TXT`;let r=Le(e),i=r.get(t.toLowerCase()),a=r.get(`*`),o=i??a;if(!o)return`ALLOWED`;let s=[...o.disallow.map(e=>({pattern:e,allow:!1})),...o.allow.map(e=>({pattern:e,allow:!0}))].filter(e=>e.pattern&&Re(e.pattern,n));return s.length===0?`ALLOWED`:(s.sort((e,t)=>t.pattern.length-e.pattern.length||(e.allow?-1:t.allow?1:0)),s[0].allow?`ALLOWED`:`DISALLOWED`)}function Be(e,t){return e===200?`SUCCESS_200`:e===403?`BLOCKED_403`:e===429?`BLOCKED_429`:e>=500?`SERVER_ERROR_5XX`:t||e>=300&&e<400?`REDIRECTED`:`ERROR`}function Ve(e){return e.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,``).replace(/<style[^>]*>[\s\S]*?<\/style>/gi,``).replace(/<noscript[^>]*>[\s\S]*?<\/noscript>/gi,``).replace(/<[^>]+>/g,` `).replace(/&nbsp;/g,` `).replace(/\s+/g,` `).trim().length}async function He(e,t,n){let r=(()=>{try{return new URL(e).pathname||`/`}catch{return`/`}})(),i=ze(n,t.name,r),a=`ERROR`,o,s,c,l,u,d=!1;try{let n=Date.now(),r=await V(e,{headers:{"User-Agent":t.userAgent},redirect:`follow`});if(s=Date.now()-n,o=r.status,l=r.url,a=Be(r.status,r.redirected),r.status===200){let e=await r.text();c=e.length,u=Ve(e),u<R&&(d=!0)}}catch(e){a=e instanceof Error&&e.name===`AbortError`?`TIMEOUT`:`ERROR`}let f=(i===`ALLOWED`||i===`NO_ROBOTS_TXT`)&&(a===`BLOCKED_403`||a===`BLOCKED_429`||a===`SERVER_ERROR_5XX`);return{bot:t.name,userAgent:t.userAgent,robotsStatus:i,fetchStatus:a,httpStatus:o,responseTimeMs:s,contentLength:c,finalUrl:l,bodyTextLength:u,silentBlock:f,likelyJsRendered:d}}async function H(e){let[t,n]=await Promise.all([Fe(e),Ie(e)]),r=await Promise.all(z.map(n=>He(e,n,t.raw))),i={};for(let e of r)i[e.bot]=e;return{scannedAt:Date.now(),url:e,robotsTxt:t,llmsTxt:n,bots:i}}async function U(e){let t;try{t=new URL(e).hostname}catch{return H(e)}let n=B.get(t);if(n&&Date.now()-n.cachedAt<Pe)return n.promise;let r=H(e);return B.set(t,{promise:r,cachedAt:Date.now()}),r.catch(()=>{B.get(t)?.promise===r&&B.delete(t)}),r}function W(e,t,n,r,i,a){return{ruleId:e,ruleName:t,message:n,severity:r,category:F,tier:I,fix:i,learnMoreUrl:Me,data:a}}var Ue={meta:{id:`ai/all-crawlers-blocked`,name:`AI: site-wide AI access blocked`,category:F,tier:I,description:`Every tested AI bot is blocked (robots.txt or live block) — page is invisible to AI assistants`},async run(e){let t=await U(e),n=z.length,r=Object.values(t.bots).filter(e=>e.robotsStatus===`DISALLOWED`||e.fetchStatus===`BLOCKED_403`||e.fetchStatus===`BLOCKED_429`||e.fetchStatus===`SERVER_ERROR_5XX`);return r.length<n?[]:[W(`ai/all-crawlers-blocked`,`AI: site-wide AI access blocked`,`All ${n} AI bots tested are blocked \u2014 by robots.txt or live block. ChatGPT, Claude, Perplexity, and Gemini cannot read or cite this page.`,`CRITICAL`,`Review robots.txt for blanket AI bot Disallow rules. If using Cloudflare, check Security → Bots → AI Scrapers and Crawlers and allow the bots you want to remain visible to.`,{blocked:r.length,total:n})]}};function G(e){return{meta:{id:e.id,name:e.name,category:F,tier:I,description:e.description},async run(t){let n=(await U(t)).bots[e.bot];return n.silentBlock?[W(e.id,e.name,`robots.txt allows ${e.bot} but the live fetch returned HTTP ${n.httpStatus}. This is the Cloudflare-default block: AI bots get a 403 at the edge regardless of what your robots.txt says.`,`CRITICAL`,`Cloudflare \u2192 Security \u2192 Bots \u2192 AI Scrapers and Crawlers \u2192 set "${e.bot}" to Allow. Or, if you intend to opt out, add "User-agent: ${e.bot}\\nDisallow: /" to robots.txt so the signal is intentional.`,{bot:e.bot,httpStatus:n.httpStatus,userAgent:n.userAgent,robotsStatus:n.robotsStatus,fetchStatus:n.fetchStatus})]:[]}}}var We=G({id:`ai/gptbot-silent-block`,name:`AI: GPTBot silent block`,bot:`GPTBot`,description:`robots.txt allows GPTBot but live fetch returns 403/429 (likely Cloudflare or WAF block)`}),Ge=G({id:`ai/claudebot-silent-block`,name:`AI: ClaudeBot silent block`,bot:`ClaudeBot`,description:`robots.txt allows ClaudeBot but live fetch returns 403/429`}),Ke=G({id:`ai/perplexitybot-silent-block`,name:`AI: PerplexityBot silent block`,bot:`PerplexityBot`,description:`robots.txt allows PerplexityBot but live fetch returns 403/429`});function K(e){return{meta:{id:e.id,name:e.name,category:F,tier:I,description:e.description},async run(t){let n=(await U(t)).bots[e.bot],r=n.robotsStatus===`DISALLOWED`,i=n.fetchStatus===`BLOCKED_403`||n.fetchStatus===`BLOCKED_429`||n.fetchStatus===`SERVER_ERROR_5XX`;if(!r&&!i)return[];let a=r?`robots.txt disallows it`:`the live fetch returned HTTP ${n.httpStatus}`;return[W(e.id,e.name,`${e.bot} cannot reach this page \u2014 ${a}. When a user asks ${e.serviceLabel} a question that should cite this page, the assistant cannot retrieve the content.`,`CRITICAL`,r?`Remove the User-agent: ${e.bot} Disallow rule from robots.txt. "-User" variants represent live retrieval at user request, not training \u2014 opting out of these typically isn't intentional.`:`Cloudflare or your WAF is blocking ${e.bot}. Allow this bot at the edge \u2014 it represents live AI assistant browsing, not training. Blocking it removes you from ${e.serviceLabel}'s answers.`,{bot:e.bot,userAgent:n.userAgent,httpStatus:n.httpStatus,robotsStatus:n.robotsStatus,fetchStatus:n.fetchStatus})]}}}var q=[Ue,We,Ge,Ke,K({id:`ai/chatgpt-user-blocked`,name:`AI: ChatGPT-User cannot reach page`,bot:`ChatGPT-User`,serviceLabel:`ChatGPT`,description:`ChatGPT-User cannot reach the page — blocks live ChatGPT browsing when users ask questions`}),K({id:`ai/claude-user-blocked`,name:`AI: Claude-User cannot reach page`,bot:`Claude-User`,serviceLabel:`Claude`,description:`Claude-User cannot reach the page — blocks live Claude browsing`}),K({id:`ai/perplexity-user-blocked`,name:`AI: Perplexity-User cannot reach page`,bot:`Perplexity-User`,serviceLabel:`Perplexity`,description:`Perplexity-User cannot reach the page — blocks live Perplexity browsing`}),{meta:{id:`ai/google-extended-disallowed`,name:`AI: Google-Extended disallowed`,category:F,tier:I,description:`Google-Extended disallowed — opt-out from Google AI (Gemini, AI Overviews); confirm this is intentional`},async run(e){let t=await U(e);return t.bots[`Google-Extended`].robotsStatus===`DISALLOWED`?[W(`ai/google-extended-disallowed`,`AI: Google-Extended disallowed`,`robots.txt disallows Google-Extended — your content is opted out of Google AI (Gemini training and AI Overviews). Confirm this is intentional.`,`WARNING`,`If you want to appear in Google AI Overviews and Gemini responses, remove the User-agent: Google-Extended Disallow rule from robots.txt. This is separate from regular Googlebot — disallowing Google-Extended does not affect search rankings.`,{robotsStatus:t.bots[`Google-Extended`].robotsStatus})]:[]}},{meta:{id:`ai/applebot-extended-disallowed`,name:`AI: Applebot-Extended disallowed`,category:F,tier:I,description:`Applebot-Extended disallowed — opt-out from Apple Intelligence; confirm this is intentional`},async run(e){let t=await U(e);return t.bots[`Applebot-Extended`].robotsStatus===`DISALLOWED`?[W(`ai/applebot-extended-disallowed`,`AI: Applebot-Extended disallowed`,`robots.txt disallows Applebot-Extended — your content is opted out of Apple Intelligence training. Confirm this is intentional.`,`INFO`,`If you want Apple Intelligence to learn from this page, remove the User-agent: Applebot-Extended Disallow from robots.txt. Regular Applebot (search) is unaffected.`,{robotsStatus:t.bots[`Applebot-Extended`].robotsStatus})]:[]}},{meta:{id:`ai/empty-content-to-bot`,name:`AI: bot receives near-empty content`,category:F,tier:I,description:`AI bot receives near-empty content (likely client-side rendering blocks the bot from seeing the page)`},async run(e){let t=await U(e),n=Object.values(t.bots).filter(e=>e.likelyJsRendered&&e.fetchStatus===`SUCCESS_200`);if(n.length===0)return[];let r=n.map(e=>e.bot).join(`, `),i=Math.min(...n.map(e=>e.bodyTextLength??0));return[W(`ai/empty-content-to-bot`,`AI: bot receives near-empty content`,`${n.length} bot${n.length===1?``:`s`} (${r}) received a 200 OK but the HTML body contained only ${i} characters of readable text. Your content is likely hydrated client-side and invisible to non-rendering crawlers.`,`WARNING`,`Server-render the primary content of this page, or pre-render for known bot UAs. AI crawlers do not execute JavaScript — content rendered after hydration is invisible to them.`,{bots:n.map(e=>e.bot),minBodyTextLength:i,threshold:R})]}},{meta:{id:`ai/llms-txt-missing`,name:`AI: llms.txt not found`,category:F,tier:I,description:`llms.txt file not found — experimental, low confirmed impact; included for completeness`},async run(e){return(await U(e)).llmsTxt.exists?[]:[W(`ai/llms-txt-missing`,`AI: llms.txt not found`,`No /llms.txt file at the site root. This is an experimental proposed standard for giving AI assistants a curated index — low confirmed impact today, but trivial to add.`,`INFO`,`If you want to provide an LLM-friendly site index, add /llms.txt at the root listing your most important pages. Spec at https://llmstxt.org. Skip this if you do not want to participate in the experiment.`,{exists:!1})]}}],J=[ie,se,ce,le,ue,de,fe,pe,me,he,ge,_e,ye,be,xe,C,w,T,E,D,O,k,Se,Ce,we,Te,Ee,De,Oe,ke],Y=[je],X=[ae,oe,ve,Ae,...q],Z={name:`@lintpage/pro`,rules:J,asyncRules:Y,standaloneRules:X};function qe(){return Z}const Q=(0,n.default)(`lintpage`);function Je(e,t){let n=[...o,...J,...Y,...X],r={};for(let t of n){let n=t.meta.category===`AI Visibility`;e===`only`?r[t.meta.id]=n:n&&(r[t.meta.id]=!1)}return{...t??{},rules:{...t?.rules??{},...r}}}async function Ye(e){let t=await v(q,e),n=g(t),r=h(t),i=t.some(e=>e.severity===`CRITICAL`&&e.category!==`AI Visibility`),a=t.some(e=>e.severity===`CRITICAL`&&e.category===`AI Visibility`),o=i?`FAIL`:a?`AI-FAIL`:`PASS`;return{url:e,timestamp:new Date().toISOString(),results:t,score:n,overallStatus:o,categoryScores:r}}Q.command(`<url>`,`Run an audit on a URL`).option(`--format <format>`,`Output format: text, json, github`,{default:`text`}).option(`--config <path>`,`Path to config file`).option(`--fail-on-warning`,`Exit 1 on warnings (not just criticals)`).option(`--ai-only`,`Run only the AI Visibility module (LP-050…LP-060)`).option(`--skip-ai`,`Skip the AI Visibility module`).option(`--quiet`,`Minimal output (counts only)`).action(async(n,r)=>{let i=r.format||`text`,a=r.config,o=!!r.failOnWarning,s=!!r.aiOnly,c=!!r.skipAi,l=!!r.quiet;s&&c&&(console.error(t.default.red(`Error: --ai-only and --skip-ai are mutually exclusive.`)),process.exit(2));try{let r=n;!r.startsWith(`http://`)&&!r.startsWith(`https://`)&&(r=`https://${r}`);let u=ne(a)??void 0;c&&(u=Je(`skip`,u)),!l&&i===`text`&&console.log(t.default.dim(`Auditing ${r}...`));let d=s?await Ye(r):await y(r,{plugins:[qe()],config:u});console.log(e.t(d,i,l));let f=d.results.some(e=>e.severity===`CRITICAL`),p=d.results.some(e=>e.severity===`WARNING`);f&&process.exit(1),o&&p&&process.exit(1),process.exit(0)}catch(e){i===`json`?console.error(JSON.stringify({error:e instanceof Error?e.message:String(e)})):console.error(t.default.red(`Error: ${e instanceof Error?e.message:String(e)}`)),process.exit(2)}}),Q.command(`init`,`Generate a .lintpagerc.json config file`).action(()=>{let e=(0,a.join)(process.cwd(),`.lintpagerc.json`);(0,i.existsSync)(e)&&(console.log(t.default.yellow(`.lintpagerc.json already exists`)),process.exit(0));let n=re();(0,i.writeFileSync)(e,JSON.stringify(n,null,2)+`
4
+ `),console.log(t.default.green(`Created .lintpagerc.json`)),process.exit(0)}),Q.help();const $=(0,a.join)(__dirname,`..`,`package.json`),Xe=(0,i.existsSync)($)?JSON.parse((0,i.readFileSync)($,`utf-8`)):{version:`0.0.0`};Q.version(Xe.version);try{Q.parse()}catch(e){e instanceof Error&&e.message?(console.error(t.default.red(`Error: ${e.message}`)),console.error(t.default.dim(`Run "lintpage --help" for usage information.`))):console.error(t.default.red(`Error: ${String(e)}`)),process.exit(2)}
4
5
  //# sourceMappingURL=cli.cjs.map