indxel-cli 0.3.0 → 0.3.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/dist/bin.js CHANGED
@@ -584,6 +584,23 @@ function extractStaticMetadata(source) {
584
584
  }
585
585
  }
586
586
  }
587
+ if (!meta.title && /(?:^|[,{\n])\s*title\s*:\s*(?:\{|[a-zA-Z_$])/.test(metaBlock)) {
588
+ meta.title = "[detected]";
589
+ }
590
+ if (!meta.description && /(?:^|[,{\n])\s*description\s*:\s*[a-zA-Z_$]/.test(metaBlock)) {
591
+ meta.description = "[detected]";
592
+ }
593
+ if (/openGraph\s*:\s*\{/.test(metaBlock)) {
594
+ if (!meta.ogTitle) meta.ogTitle = "[detected]";
595
+ if (!meta.ogDescription) meta.ogDescription = "[detected]";
596
+ if (!meta.ogImage) meta.ogImage = "[detected]";
597
+ }
598
+ if (/twitter\s*:\s*\{/.test(metaBlock)) {
599
+ if (!meta.twitterCard) meta.twitterCard = "[detected]";
600
+ }
601
+ if (/alternates\s*:\s*\{/.test(metaBlock) && !meta.canonical) {
602
+ if (/canonical\s*:/.test(metaBlock)) meta.canonical = "[detected]";
603
+ }
587
604
  if (/application\/ld\+json/.test(source) || /generateLD/.test(source) || /JsonLD/.test(source)) {
588
605
  meta.structuredData = [{ "@context": "https://schema.org", "@type": "detected" }];
589
606
  }
@@ -1815,6 +1832,8 @@ async function fetchPsi(url, strategy) {
1815
1832
  strategy,
1816
1833
  category: "performance"
1817
1834
  });
1835
+ const apiKey = process.env.PSI_API_KEY;
1836
+ if (apiKey) params.set("key", apiKey);
1818
1837
  const res = await fetch(
1819
1838
  `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?${params}`,
1820
1839
  { signal: AbortSignal.timeout(6e4) }