@vesk/vesk-cli 0.2.50-canary.6 → 0.2.50-canary.7

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 (2) hide show
  1. package/dist/cli.js +23 -3
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -34373,14 +34373,18 @@ function collectCombinedSource(appDir) {
34373
34373
  }
34374
34374
  return combined;
34375
34375
  }
34376
+ function hasMetadataDeclaration(src2) {
34377
+ return /\bdefineMetadata\s*\(|export\s+const\s+metadata\b/.test(src2);
34378
+ }
34376
34379
  function runSeoAudit(appDir, _options) {
34377
34380
  const combined = collectCombinedSource(appDir);
34378
34381
  if (combined.length === 0) {
34379
34382
  console.error("vesk seo-audit: no page.vsk files found");
34380
- return { passed: 0, errors: 0, warnings: 0 };
34383
+ return { passed: 0, errors: 0, warnings: 0, issues: [] };
34381
34384
  }
34382
34385
  let errors = 0;
34383
34386
  let warnings = 0;
34387
+ const allIssues = [];
34384
34388
  for (const { path, src: src2 } of combined) {
34385
34389
  const relPath = path.replace(appDir, "").replace(/^[\\/]/, "");
34386
34390
  const routeDir = relPath === "page.vsk" ? "" : relPath.replace(/[\\/]page\.vsk$/, "");
@@ -34392,6 +34396,7 @@ function runSeoAudit(appDir, _options) {
34392
34396
  for (const check of Object.values(SEO_CHECKS)) {
34393
34397
  const issues = check(src2);
34394
34398
  for (const issue of issues) {
34399
+ allIssues.push({ ...issue, page: relPath || "page.vsk" });
34395
34400
  if (issue.severity === SEVERITY.ERROR) {
34396
34401
  fileErrors++;
34397
34402
  } else {
@@ -34415,7 +34420,7 @@ function runSeoAudit(appDir, _options) {
34415
34420
  const total = combined.length;
34416
34421
  const status = errors > 0 ? "FAIL" : warnings > 0 ? "PASS_WARN" : "PASS";
34417
34422
  console.error(`vesk seo-audit: ${total} pages \u2014 ${errors} errors, ${warnings} warnings [${status}]`);
34418
- return { passed: total, errors, warnings };
34423
+ return { passed: total, errors, warnings, issues: allIssues };
34419
34424
  }
34420
34425
  var SEVERITY, SEO_CHECKS;
34421
34426
  var init_seo_audit = __esm({
@@ -34458,6 +34463,12 @@ var init_seo_audit = __esm({
34458
34463
  return issues;
34459
34464
  },
34460
34465
  metaDescription: (src2) => {
34466
+ if (hasMetadataDeclaration(src2)) {
34467
+ if (!/\bdescription\s*:/.test(src2)) {
34468
+ return [{ severity: SEVERITY.WARN, message: "No `description` in the metadata declaration" }];
34469
+ }
34470
+ return [];
34471
+ }
34461
34472
  if (!/name=["']description["']/.test(src2)) {
34462
34473
  return [{ severity: SEVERITY.WARN, message: "Missing meta description" }];
34463
34474
  }
@@ -34465,6 +34476,9 @@ var init_seo_audit = __esm({
34465
34476
  },
34466
34477
  ogTags: (src2) => {
34467
34478
  const issues = [];
34479
+ if (hasMetadataDeclaration(src2)) {
34480
+ return issues;
34481
+ }
34468
34482
  const required2 = ["og:title", "og:description", "og:image"];
34469
34483
  for (const tag of required2) {
34470
34484
  const pattern2 = new RegExp(`property=["']${tag}["']`);
@@ -34481,8 +34495,14 @@ var init_seo_audit = __esm({
34481
34495
  return [];
34482
34496
  },
34483
34497
  title: (src2) => {
34498
+ if (hasMetadataDeclaration(src2)) {
34499
+ if (!/\btitle\s*:/.test(src2)) {
34500
+ return [{ severity: SEVERITY.WARN, message: "No `title` in the metadata declaration \u2014 it will render no <title>" }];
34501
+ }
34502
+ return [];
34503
+ }
34484
34504
  if (!/<title>/i.test(src2) && !/<Head>/i.test(src2) && !/title>/i.test(src2)) {
34485
- return [{ severity: SEVERITY.ERROR, message: "Missing <title> or <Head> \u2014 page title is critical for SEO" }];
34505
+ return [{ severity: SEVERITY.ERROR, message: "Missing <title>, <Head>, or `export const metadata` \u2014 page title is critical for SEO" }];
34486
34506
  }
34487
34507
  return [];
34488
34508
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.50-canary.6",
3
+ "version": "0.2.50-canary.7",
4
4
  "type": "module",
5
5
  "description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
6
6
  "bin": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "main": "./dist/cli.js",
10
10
  "dependencies": {
11
- "@vesk/adapter": "^0.2.50-canary.6",
12
- "@vesk/compiler": "^0.2.50-canary.6",
13
- "@vesk/plugin-tailwind": "^0.2.50-canary.6",
14
- "@vesk/runtime": "^0.2.50-canary.6",
11
+ "@vesk/adapter": "^0.2.50-canary.7",
12
+ "@vesk/compiler": "^0.2.50-canary.7",
13
+ "@vesk/plugin-tailwind": "^0.2.50-canary.7",
14
+ "@vesk/runtime": "^0.2.50-canary.7",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",