@ultimat3/seo 16.0.0 → 18.0.0

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/package.json +3 -3
  2. package/src/validate.ts +22 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimat3/seo",
3
- "version": "16.0.0",
3
+ "version": "18.0.0",
4
4
  "description": "Enforced SEO: typed meta, JSON-LD, sitemap, robots, feeds, responsive images, perf budgets",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,13 +24,13 @@
24
24
  "LICENSE"
25
25
  ],
26
26
  "engines": {
27
- "bun": ">=1.3.0"
27
+ "bun": ">=1.4.0"
28
28
  },
29
29
  "scripts": {
30
30
  "typecheck": "tsc --noEmit -p tsconfig.json",
31
31
  "test": "bun test"
32
32
  },
33
33
  "dependencies": {
34
- "@ultimat3/core": "16.0.0"
34
+ "@ultimat3/core": "18.0.0"
35
35
  }
36
36
  }
package/src/validate.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  // catches the three failures that only show up weeks later in Search Console:
4
4
  // duplicate meta, an over-length title, and a canonical that lies.
5
5
 
6
+ import { finiteCount } from '@ultimat3/core';
6
7
  import {
7
8
  canonicalMismatch,
8
9
  duplicateMeta,
@@ -48,8 +49,27 @@ export function validateMeta(
48
49
  routes: readonly RouteRecord[],
49
50
  options: ValidateMetaOptions = {},
50
51
  ): MetaValidationReport {
51
- const titleMax = options.titleMaxLength ?? TITLE_MAX_LENGTH;
52
- const descriptionMax = options.descriptionMaxLength ?? DESCRIPTION_MAX_LENGTH;
52
+ // `rendered.length > NaN` is false for every title, so a ceiling that is not a number is not a
53
+ // loose rule it is no rule, and the report comes back clean on a site whose every title is
54
+ // truncated in the SERP.
55
+ //
56
+ // `=== undefined`, never `??`: `??` also coalesces on `null`, so an explicit `null` from a
57
+ // decoded JSON config was swapped for the default BEFORE `finiteCount` could refuse it. Only an
58
+ // ABSENT option takes the default; a present one that is not a number is a refusal naming it.
59
+ const titleMax = finiteCount(
60
+ 'validateMeta',
61
+ 'titleMaxLength',
62
+ options.titleMaxLength === undefined ? TITLE_MAX_LENGTH : options.titleMaxLength,
63
+ 1,
64
+ );
65
+ const descriptionMax = finiteCount(
66
+ 'validateMeta',
67
+ 'descriptionMaxLength',
68
+ options.descriptionMaxLength === undefined
69
+ ? DESCRIPTION_MAX_LENGTH
70
+ : options.descriptionMaxLength,
71
+ 1,
72
+ );
53
73
  const checked = indexableRoutes(routes);
54
74
  const issues: MetaIssue[] = [];
55
75