aeo.js 0.0.6 → 0.0.8

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.
Files changed (67) hide show
  1. package/dist/angular.d.mts +1 -1
  2. package/dist/angular.d.ts +1 -1
  3. package/dist/angular.js +65 -11
  4. package/dist/angular.js.map +1 -1
  5. package/dist/angular.mjs +65 -11
  6. package/dist/angular.mjs.map +1 -1
  7. package/dist/astro.d.mts +1 -1
  8. package/dist/astro.d.ts +1 -1
  9. package/dist/astro.js +74 -16
  10. package/dist/astro.js.map +1 -1
  11. package/dist/astro.mjs +74 -16
  12. package/dist/astro.mjs.map +1 -1
  13. package/dist/cli.js +80 -25
  14. package/dist/cli.js.map +1 -1
  15. package/dist/cli.mjs +80 -25
  16. package/dist/cli.mjs.map +1 -1
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +85 -27
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +85 -27
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/next.d.mts +1 -1
  24. package/dist/next.d.ts +1 -1
  25. package/dist/next.js +65 -11
  26. package/dist/next.js.map +1 -1
  27. package/dist/next.mjs +65 -11
  28. package/dist/next.mjs.map +1 -1
  29. package/dist/nuxt.d.mts +1 -1
  30. package/dist/nuxt.d.ts +1 -1
  31. package/dist/nuxt.js +65 -11
  32. package/dist/nuxt.js.map +1 -1
  33. package/dist/nuxt.mjs +65 -11
  34. package/dist/nuxt.mjs.map +1 -1
  35. package/dist/react.d.mts +1 -1
  36. package/dist/react.d.ts +1 -1
  37. package/dist/react.js +61 -9
  38. package/dist/react.js.map +1 -1
  39. package/dist/react.mjs +61 -9
  40. package/dist/react.mjs.map +1 -1
  41. package/dist/{types-Cn_Qbkmg.d.mts → types-BlLNcw-X.d.mts} +2 -0
  42. package/dist/{types-Cn_Qbkmg.d.ts → types-BlLNcw-X.d.ts} +2 -0
  43. package/dist/vite.d.mts +1 -1
  44. package/dist/vite.d.ts +1 -1
  45. package/dist/vite.js +90 -18
  46. package/dist/vite.js.map +1 -1
  47. package/dist/vite.mjs +90 -18
  48. package/dist/vite.mjs.map +1 -1
  49. package/dist/vue.d.mts +1 -1
  50. package/dist/vue.d.ts +1 -1
  51. package/dist/vue.js +61 -9
  52. package/dist/vue.js.map +1 -1
  53. package/dist/vue.mjs +61 -9
  54. package/dist/vue.mjs.map +1 -1
  55. package/dist/webpack.d.mts +1 -1
  56. package/dist/webpack.d.ts +1 -1
  57. package/dist/webpack.js +65 -11
  58. package/dist/webpack.js.map +1 -1
  59. package/dist/webpack.mjs +65 -11
  60. package/dist/webpack.mjs.map +1 -1
  61. package/dist/widget.d.mts +1 -1
  62. package/dist/widget.d.ts +1 -1
  63. package/dist/widget.js +61 -9
  64. package/dist/widget.js.map +1 -1
  65. package/dist/widget.mjs +61 -9
  66. package/dist/widget.mjs.map +1 -1
  67. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -80,10 +80,19 @@ function generateRobotsTxt(config) {
80
80
  }
81
81
  lines.push("# Default for all other bots");
82
82
  lines.push("User-agent: *");
83
- lines.push("Allow: /");
83
+ for (const path of config.robots.allow.length > 0 ? config.robots.allow : ["/"]) {
84
+ lines.push(`Allow: ${path}`);
85
+ }
86
+ for (const path of config.robots.disallow) {
87
+ lines.push(`Disallow: ${path}`);
88
+ }
89
+ if (config.robots.crawlDelay > 0) {
90
+ lines.push(`Crawl-delay: ${config.robots.crawlDelay}`);
91
+ }
84
92
  lines.push("");
85
- if (config.url) {
86
- lines.push(`Sitemap: ${config.url}/sitemap.xml`);
93
+ const sitemapUrl = config.robots.sitemap || (config.url ? `${config.url}/sitemap.xml` : "");
94
+ if (sitemapUrl) {
95
+ lines.push(`Sitemap: ${sitemapUrl}`);
87
96
  }
88
97
  lines.push("");
89
98
  lines.push("# AEO (Answer Engine Optimization) files");
@@ -165,7 +174,7 @@ function detectFramework(projectRoot = process.cwd()) {
165
174
  };
166
175
  }
167
176
  function resolveConfig(config = {}) {
168
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M;
177
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N;
169
178
  const frameworkInfo = detectFramework();
170
179
  return {
171
180
  title: config.title || "My Site",
@@ -209,15 +218,16 @@ function resolveConfig(config = {}) {
209
218
  widget: {
210
219
  enabled: ((_A = config.widget) == null ? void 0 : _A.enabled) !== false,
211
220
  position: ((_B = config.widget) == null ? void 0 : _B.position) || "bottom-right",
221
+ size: ((_C = config.widget) == null ? void 0 : _C.size) || "default",
212
222
  theme: {
213
- background: ((_D = (_C = config.widget) == null ? void 0 : _C.theme) == null ? void 0 : _D.background) || "rgba(18, 18, 24, 0.9)",
214
- text: ((_F = (_E = config.widget) == null ? void 0 : _E.theme) == null ? void 0 : _F.text) || "#C0C0C5",
215
- accent: ((_H = (_G = config.widget) == null ? void 0 : _G.theme) == null ? void 0 : _H.accent) || "#E8E8EA",
216
- badge: ((_J = (_I = config.widget) == null ? void 0 : _I.theme) == null ? void 0 : _J.badge) || "#4ADE80"
223
+ background: ((_E = (_D = config.widget) == null ? void 0 : _D.theme) == null ? void 0 : _E.background) || "rgba(18, 18, 24, 0.9)",
224
+ text: ((_G = (_F = config.widget) == null ? void 0 : _F.theme) == null ? void 0 : _G.text) || "#C0C0C5",
225
+ accent: ((_I = (_H = config.widget) == null ? void 0 : _H.theme) == null ? void 0 : _I.accent) || "#E8E8EA",
226
+ badge: ((_K = (_J = config.widget) == null ? void 0 : _J.theme) == null ? void 0 : _K.badge) || "#4ADE80"
217
227
  },
218
- humanLabel: ((_K = config.widget) == null ? void 0 : _K.humanLabel) || "Human",
219
- aiLabel: ((_L = config.widget) == null ? void 0 : _L.aiLabel) || "AI",
220
- showBadge: ((_M = config.widget) == null ? void 0 : _M.showBadge) !== false
228
+ humanLabel: ((_L = config.widget) == null ? void 0 : _L.humanLabel) || "Human",
229
+ aiLabel: ((_M = config.widget) == null ? void 0 : _M.aiLabel) || "AI",
230
+ showBadge: ((_N = config.widget) == null ? void 0 : _N.showBadge) !== false
221
231
  }
222
232
  };
223
233
  }
@@ -845,6 +855,22 @@ function generatePageSchemas(page, config) {
845
855
  }))
846
856
  });
847
857
  }
858
+ if (faqItems.length === 0) {
859
+ const howToSteps = detectHowToSteps(page.content || "");
860
+ if (howToSteps.length > 0) {
861
+ schemas.push({
862
+ "@context": "https://schema.org",
863
+ "@type": "HowTo",
864
+ name: page.title || config.title,
865
+ step: howToSteps.map((s, i) => ({
866
+ "@type": "HowToStep",
867
+ position: i + 1,
868
+ name: s.name,
869
+ text: s.text
870
+ }))
871
+ });
872
+ }
873
+ }
848
874
  const pageType = config.schema.defaultType;
849
875
  const pageSchema = {
850
876
  "@context": "https://schema.org",
@@ -921,6 +947,34 @@ function detectFaqPatterns(content) {
921
947
  }
922
948
  return items;
923
949
  }
950
+ function detectHowToSteps(content) {
951
+ const steps = [];
952
+ const lines = content.split("\n");
953
+ for (let i = 0; i < lines.length; i++) {
954
+ const line = lines[i].trim();
955
+ const stepMatch = line.match(/^#{1,6}\s+(?:Step\s+\d+[\s:.-]*|(\d+)[.)]\s*)(.+)$/i);
956
+ if (stepMatch) {
957
+ const name = (stepMatch[2] || stepMatch[1] || "").trim();
958
+ const bodyLines = [];
959
+ for (let j = i + 1; j < lines.length; j++) {
960
+ const nextLine = lines[j].trim();
961
+ if (!nextLine) {
962
+ if (bodyLines.length > 0) break;
963
+ continue;
964
+ }
965
+ if (/^#{1,6}\s/.test(nextLine)) break;
966
+ bodyLines.push(nextLine);
967
+ }
968
+ if (name) {
969
+ steps.push({
970
+ name,
971
+ text: bodyLines.join(" ").slice(0, 500)
972
+ });
973
+ }
974
+ }
975
+ }
976
+ return steps.length >= 2 ? steps : [];
977
+ }
924
978
  async function generateAEOFiles(configOrRoot, maybeConfig) {
925
979
  var _a;
926
980
  let config;
@@ -1130,15 +1184,18 @@ function auditSchemaPresence(config, issues, suggestions) {
1130
1184
  if (!hasLogo) {
1131
1185
  suggestions.push("Add schema.organization.logo for richer search results and AI knowledge");
1132
1186
  }
1133
- const hasSameAs = config.schema.organization.sameAs.length > 0;
1134
- checks.push({ label: "Social profiles linked (sameAs)", passed: hasSameAs, points: hasSameAs ? 4 : 0 });
1135
- if (!hasSameAs) {
1136
- issues.push({ category: "Schema Presence", severity: "warning", message: "No social profiles (sameAs) \u2014 critical for GEO/E-E-A-T signals", fix: "Add schema.organization.sameAs with social profile URLs" });
1187
+ const hasFaqOrHowTo = config.pages.some((p) => {
1188
+ const content = p.content || "";
1189
+ return /^#{1,6}\s+.+\?\s*$/m.test(content) || /^#{1,6}\s+(?:Step\s+\d+[\s:.-]|How\s+to)/im.test(content);
1190
+ });
1191
+ checks.push({ label: "FAQPage or HowTo schema", passed: hasFaqOrHowTo, points: hasFaqOrHowTo ? 4 : 0 });
1192
+ if (!hasFaqOrHowTo) {
1193
+ suggestions.push("Add FAQ sections (question headings) or step-by-step content to auto-generate FAQPage/HowTo schema");
1137
1194
  }
1138
- const hasRealUrl = config.url !== "https://example.com" && config.url !== "";
1139
- checks.push({ label: "Site URL is configured (not default)", passed: hasRealUrl, points: hasRealUrl ? 4 : 0 });
1140
- if (!hasRealUrl) {
1141
- issues.push({ category: "Schema Presence", severity: "error", message: "Site URL is still the default (https://example.com)", fix: "Set url to your actual site URL" });
1195
+ const hasArticleOrWebPage = schemaEnabled && (config.schema.defaultType === "Article" || config.schema.defaultType === "WebPage");
1196
+ checks.push({ label: "Article/WebPage schema", passed: hasArticleOrWebPage, points: hasArticleOrWebPage ? 4 : 0 });
1197
+ if (!hasArticleOrWebPage && schemaEnabled) {
1198
+ suggestions.push('Set schema.defaultType to "Article" or "WebPage" for per-page structured data');
1142
1199
  }
1143
1200
  return {
1144
1201
  name: "Schema Presence",
@@ -1177,12 +1234,10 @@ function auditMetaQuality(config, issues, suggestions) {
1177
1234
  if (!goodTitleCoverage && config.pages.length > 0) {
1178
1235
  issues.push({ category: "Meta Quality", severity: "warning", message: `Only ${pagesWithTitles.length}/${config.pages.length} pages have titles`, fix: "Add titles to all pages" });
1179
1236
  }
1180
- const pagesWithDesc = config.pages.filter((p) => p.description && p.description.length > 0);
1181
- const descCoverage = config.pages.length > 0 ? pagesWithDesc.length / config.pages.length : 0;
1182
- const goodDescCoverage = descCoverage >= 0.5;
1183
- checks.push({ label: "50%+ of pages have descriptions", passed: goodDescCoverage, points: goodDescCoverage ? 4 : 0 });
1184
- if (!goodDescCoverage && config.pages.length > 0) {
1185
- suggestions.push(`Only ${pagesWithDesc.length}/${config.pages.length} pages have descriptions \u2014 add per-page descriptions`);
1237
+ const hasOgImage = !!config.og.image;
1238
+ checks.push({ label: "OG image configured", passed: hasOgImage, points: hasOgImage ? 4 : 0 });
1239
+ if (!hasOgImage) {
1240
+ suggestions.push("Set og.image for richer social sharing previews and AI citation cards");
1186
1241
  }
1187
1242
  return {
1188
1243
  name: "Meta Quality",