@ultimat3/seo 31.35.0 → 31.37.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.
- package/package.json +3 -3
- package/src/errors.ts +15 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/seo",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.37.0",
|
|
4
4
|
"description": "Enforced SEO: typed meta, JSON-LD, sitemap, robots, feeds, responsive images, perf budgets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"test": "bun test"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@ultimat3/core": "31.
|
|
47
|
-
"@ultimat3/schema": "31.
|
|
46
|
+
"@ultimat3/core": "31.37.0",
|
|
47
|
+
"@ultimat3/schema": "31.37.0"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/errors.ts
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
// of 2026-08`, is a build gate: no step of `x verify` calls the asserts that throw them (see
|
|
4
4
|
// `README.md`), so they fail the app that calls one itself and nothing else.
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
NotImplementedError,
|
|
8
|
+
registerErrorCodes,
|
|
9
|
+
renderFixLiteral,
|
|
10
|
+
UltimateError,
|
|
11
|
+
} from '@ultimat3/core';
|
|
7
12
|
// errors.ts <-> images.ts: images.ts throws imageQueryInvalid() and this file spells its fix
|
|
8
13
|
// using images.ts's IMAGE_QUERY_KEYS. Safe like core's errors.ts <-> error-codes.ts cycle:
|
|
9
14
|
// nothing at this module's top level reads the import, only the factory body below does, and by
|
|
@@ -77,7 +82,7 @@ export function metaMissing(file: string, path: string, field: string): SeoError
|
|
|
77
82
|
return new SeoError({
|
|
78
83
|
code: SEO_ERROR_CODES.metaMissing,
|
|
79
84
|
cause: `${file} (route "${path}") has no meta.${field}`,
|
|
80
|
-
fix: `
|
|
85
|
+
fix: `meta: { ${field}: '…' } // in defineRoute() in ${file}`,
|
|
81
86
|
meta: { file, path, field },
|
|
82
87
|
});
|
|
83
88
|
}
|
|
@@ -91,7 +96,7 @@ export function titleTemplateSlotMissing(file: string, path: string): SeoError {
|
|
|
91
96
|
return new SeoError({
|
|
92
97
|
code: SEO_ERROR_CODES.metaMissing,
|
|
93
98
|
cause: `${file} (route "${path}") declares a titleTemplate with no %s slot, so the page title is discarded and every route renders the brand alone`,
|
|
94
|
-
fix: `
|
|
99
|
+
fix: `meta: { titleTemplate: '%s — Ultimate' } // the %s slot, in ${file} — or delete titleTemplate and let meta.title stand alone`,
|
|
95
100
|
meta: { file, path, field: 'titleTemplate' },
|
|
96
101
|
});
|
|
97
102
|
}
|
|
@@ -100,7 +105,7 @@ export function duplicateMeta(field: string, value: string, files: readonly stri
|
|
|
100
105
|
return new SeoError({
|
|
101
106
|
code: SEO_ERROR_CODES.duplicateMeta,
|
|
102
107
|
cause: `${files.length} routes share the same ${field} ${JSON.stringify(value)}: ${files.join(', ')}`,
|
|
103
|
-
fix: `
|
|
108
|
+
fix: `meta: { ${field}: '<unique to this route>' } // in each of those routes' defineRoute()`,
|
|
104
109
|
meta: { field, value, files },
|
|
105
110
|
});
|
|
106
111
|
}
|
|
@@ -109,7 +114,7 @@ export function metaTooLong(file: string, field: string, length: number, max: nu
|
|
|
109
114
|
return new SeoError({
|
|
110
115
|
code: SEO_ERROR_CODES.metaTooLong,
|
|
111
116
|
cause: `${file} has a ${length}-character ${field}; search results truncate past ${max}`,
|
|
112
|
-
fix: `
|
|
117
|
+
fix: `meta: { ${field}: '<at most ${max} characters>' } // shortened, in ${file}`,
|
|
113
118
|
meta: { file, field, length, max },
|
|
114
119
|
});
|
|
115
120
|
}
|
|
@@ -118,7 +123,7 @@ export function canonicalMismatch(file: string, canonical: string, expected: str
|
|
|
118
123
|
return new SeoError({
|
|
119
124
|
code: SEO_ERROR_CODES.canonicalMismatch,
|
|
120
125
|
cause: `${file} declares canonical ${canonical} but the route resolves to ${expected}`,
|
|
121
|
-
fix: `
|
|
126
|
+
fix: `meta: { canonical: ${renderFixLiteral(expected, "'<the route URL>'")} } // in ${file} — or delete it and let the route supply it`,
|
|
122
127
|
meta: { file, canonical, expected },
|
|
123
128
|
});
|
|
124
129
|
}
|
|
@@ -133,7 +138,7 @@ export function linkInvalid(link: string, problem: string, file?: string): SeoEr
|
|
|
133
138
|
return new SeoError({
|
|
134
139
|
code: SEO_ERROR_CODES.linkInvalid,
|
|
135
140
|
cause: `${where} declares meta ${link}, which ${problem}`,
|
|
136
|
-
fix: `
|
|
141
|
+
fix: `meta: { links: [{ rel: 'preload', href: '/assets/…', as: 'font', crossorigin: 'anonymous' }] } // in defineRoute() in ${where}: a path or an http(s) href, as on every preload, crossorigin on a font preload`,
|
|
137
142
|
meta: { link, problem, ...(file === undefined ? {} : { file }) },
|
|
138
143
|
});
|
|
139
144
|
}
|
|
@@ -157,7 +162,7 @@ export function ldInvalid(type: string, field: string, hint: string): SeoError {
|
|
|
157
162
|
return new SeoError({
|
|
158
163
|
code: SEO_ERROR_CODES.ldInvalid,
|
|
159
164
|
cause: `ld.${type}() received an empty or missing "${field}" (${hint})`,
|
|
160
|
-
fix: `
|
|
165
|
+
fix: `{ ${field}: '…' } // non-empty, in the ld.${type}() call — schema.org requires it`,
|
|
161
166
|
meta: { type, field },
|
|
162
167
|
});
|
|
163
168
|
}
|
|
@@ -166,7 +171,7 @@ export function sitemapTooLarge(count: number, max: number): SeoError {
|
|
|
166
171
|
return new SeoError({
|
|
167
172
|
code: SEO_ERROR_CODES.sitemapTooLarge,
|
|
168
173
|
cause: `sitemap index would hold ${count} sitemaps; the protocol limit is ${max}`,
|
|
169
|
-
fix: '
|
|
174
|
+
fix: 'meta: { robots: { index: false } } // on each non-indexable route — or shard the site across hostnames',
|
|
170
175
|
meta: { count, max },
|
|
171
176
|
});
|
|
172
177
|
}
|
|
@@ -225,9 +230,7 @@ export function notImplementedDriver(
|
|
|
225
230
|
): NotImplementedError {
|
|
226
231
|
return new NotImplementedError({
|
|
227
232
|
cause: `the ${driver} image driver does not implement ${capability} yet`,
|
|
228
|
-
fix:
|
|
229
|
-
`implement ${capability} in ${at}, or swap the driver for builtinImageDriver({ read }) ` +
|
|
230
|
-
'— png and jpeg, no dependencies — then run: x verify --json',
|
|
233
|
+
fix: `builtinImageDriver({ read }) // swap the driver for this one (png and jpeg, no dependencies) — or implement ${capability} in ${at}; then x verify --json`,
|
|
231
234
|
meta: { driver, capability, at },
|
|
232
235
|
});
|
|
233
236
|
}
|