nuxtseo-shared 6.0.4 → 6.0.5

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.
@@ -36,6 +36,7 @@ interface ChecklistSummary {
36
36
  }
37
37
  declare const DEBUG_ENDPOINTS: Partial<Record<NuxtSEOModule['slug'], string>>;
38
38
  declare const DEVTOOLS_NAME_TO_SLUG: Record<string, NuxtSEOModule['slug']>;
39
+ declare function isProductionSiteUrlCheck(item: Pick<ChecklistItemDefinition, 'id'>): boolean;
39
40
  interface SetupChecklistContext {
40
41
  tipsEnabled?: boolean;
41
42
  ssr: boolean;
@@ -50,10 +51,11 @@ interface SetupChecklistContext {
50
51
  sitemapPrerendered?: boolean;
51
52
  hasSitemapOutputHook?: boolean;
52
53
  /**
53
- * OG Image signs runtime URLs with Nuxt's `appSecret`. `missing` means only Nuxt's generated
54
- * development secret exists. Unset when production does not sign runtime URLs.
54
+ * Production secret status for OG Image signing. Unset when runtime URLs are unsigned.
55
55
  */
56
56
  ogImageSecret?: 'configured' | 'missing';
57
+ /** Production secret status for AI Ready Runtime Sync. Unset when Runtime Sync is disabled. */
58
+ aiReadySecret?: 'configured' | 'missing';
57
59
  optOuts?: Partial<Record<NuxtSEOModule['slug'], string[]>>;
58
60
  moduleOptions?: Partial<Record<NuxtSEOModule['slug'], Record<string, unknown>>>;
59
61
  }
@@ -65,10 +67,11 @@ interface SetupChecklistInput {
65
67
  }
66
68
  /** Evaluate resolved module evidence without fetching endpoints or mutating application state. */
67
69
  declare function evaluateSetupChecklist(input: SetupChecklistInput): ModuleChecklistResult[];
68
- /** Terminal output uses the same evidence and severity as the DevTools checklist. */
70
+ /** Terminal output can hide cooldown-limited findings from the DevTools checklist. */
69
71
  declare function formatSetupReport(results: ModuleChecklistResult[], options?: {
70
72
  showTips?: boolean;
73
+ showSiteUrlReminder?: boolean;
71
74
  }): string;
72
75
 
73
- export { DEBUG_ENDPOINTS, DEVTOOLS_NAME_TO_SLUG, evaluateSetupChecklist, formatSetupReport, getSetupTipOptOuts, parseSetupChecklistContext };
76
+ export { DEBUG_ENDPOINTS, DEVTOOLS_NAME_TO_SLUG, evaluateSetupChecklist, formatSetupReport, getSetupTipOptOuts, isProductionSiteUrlCheck, parseSetupChecklistContext };
74
77
  export type { ChecklistDetectResult, ChecklistItemResult, ChecklistItemStatus, ChecklistSummary, ModuleChecklistResult, ModuleChecklistStatus, SetupChecklistContext, SetupChecklistInput };
@@ -36,6 +36,7 @@ interface ChecklistSummary {
36
36
  }
37
37
  declare const DEBUG_ENDPOINTS: Partial<Record<NuxtSEOModule['slug'], string>>;
38
38
  declare const DEVTOOLS_NAME_TO_SLUG: Record<string, NuxtSEOModule['slug']>;
39
+ declare function isProductionSiteUrlCheck(item: Pick<ChecklistItemDefinition, 'id'>): boolean;
39
40
  interface SetupChecklistContext {
40
41
  tipsEnabled?: boolean;
41
42
  ssr: boolean;
@@ -50,10 +51,11 @@ interface SetupChecklistContext {
50
51
  sitemapPrerendered?: boolean;
51
52
  hasSitemapOutputHook?: boolean;
52
53
  /**
53
- * OG Image signs runtime URLs with Nuxt's `appSecret`. `missing` means only Nuxt's generated
54
- * development secret exists. Unset when production does not sign runtime URLs.
54
+ * Production secret status for OG Image signing. Unset when runtime URLs are unsigned.
55
55
  */
56
56
  ogImageSecret?: 'configured' | 'missing';
57
+ /** Production secret status for AI Ready Runtime Sync. Unset when Runtime Sync is disabled. */
58
+ aiReadySecret?: 'configured' | 'missing';
57
59
  optOuts?: Partial<Record<NuxtSEOModule['slug'], string[]>>;
58
60
  moduleOptions?: Partial<Record<NuxtSEOModule['slug'], Record<string, unknown>>>;
59
61
  }
@@ -65,10 +67,11 @@ interface SetupChecklistInput {
65
67
  }
66
68
  /** Evaluate resolved module evidence without fetching endpoints or mutating application state. */
67
69
  declare function evaluateSetupChecklist(input: SetupChecklistInput): ModuleChecklistResult[];
68
- /** Terminal output uses the same evidence and severity as the DevTools checklist. */
70
+ /** Terminal output can hide cooldown-limited findings from the DevTools checklist. */
69
71
  declare function formatSetupReport(results: ModuleChecklistResult[], options?: {
70
72
  showTips?: boolean;
73
+ showSiteUrlReminder?: boolean;
71
74
  }): string;
72
75
 
73
- export { DEBUG_ENDPOINTS, DEVTOOLS_NAME_TO_SLUG, evaluateSetupChecklist, formatSetupReport, getSetupTipOptOuts, parseSetupChecklistContext };
76
+ export { DEBUG_ENDPOINTS, DEVTOOLS_NAME_TO_SLUG, evaluateSetupChecklist, formatSetupReport, getSetupTipOptOuts, isProductionSiteUrlCheck, parseSetupChecklistContext };
74
77
  export type { ChecklistDetectResult, ChecklistItemResult, ChecklistItemStatus, ChecklistSummary, ModuleChecklistResult, ModuleChecklistStatus, SetupChecklistContext, SetupChecklistInput };
@@ -38,8 +38,10 @@ function parseSetupChecklistContext(value) {
38
38
  context.nuxtMajor = data.nuxtMajor;
39
39
  if (typeof data.nitroPreset === "string" && /^[\w-]+$/.test(data.nitroPreset))
40
40
  context.nitroPreset = data.nitroPreset;
41
- if (data.ogImageSecret === "configured" || data.ogImageSecret === "missing")
42
- context.ogImageSecret = data.ogImageSecret;
41
+ for (const key of ["ogImageSecret", "aiReadySecret"]) {
42
+ if (data[key] === "configured" || data[key] === "missing")
43
+ context[key] = data[key];
44
+ }
43
45
  for (const [slug, paths] of Object.entries(OPTION_PATHS)) {
44
46
  const options = record(record(data.moduleOptions)?.[slug]);
45
47
  const selected = {};
@@ -163,20 +165,7 @@ const MODULE_META = {
163
165
  "seo-utils": { label: "SEO Utils", icon: "carbon:tools" },
164
166
  "schema-org": { label: "Schema.org", icon: "carbon:chart-relationship" }
165
167
  };
166
- function isValidUrl(value) {
167
- if (typeof value !== "string")
168
- return false;
169
- if (!URL.canParse(value))
170
- return false;
171
- const url = new URL(value);
172
- if (!["http:", "https:"].includes(url.protocol))
173
- return false;
174
- const host = url.hostname.toLowerCase();
175
- return host !== "localhost" && !host.endsWith(".localhost") && host !== "[::1]" && host !== "0.0.0.0" && !host.startsWith("127.");
176
- }
177
- function isConfiguredUrl(config, stack) {
178
- if (!isValidUrl(config?.url))
179
- return false;
168
+ function hasConfiguredSiteUrl(config, stack) {
180
169
  if (typeof config?._context?.url === "string")
181
170
  return config._context.url !== "nitro:init";
182
171
  if (config?._priority?.url === -4) {
@@ -184,19 +173,32 @@ function isConfiguredUrl(config, stack) {
184
173
  }
185
174
  return true;
186
175
  }
176
+ function detectProductionSiteUrl(config, stack) {
177
+ const value = config?.url;
178
+ if (!value || !hasConfiguredSiteUrl(config, stack))
179
+ return { passed: false, detail: "None configured." };
180
+ const url = typeof value === "string" && URL.canParse(value) ? new URL(value) : void 0;
181
+ if (!url || url.protocol !== "http:" && url.protocol !== "https:")
182
+ return { passed: false, detail: "Use an absolute HTTP or HTTPS URL." };
183
+ const host = url.hostname.replace(/\.$/, "");
184
+ if (host === "localhost" || host.endsWith(".localhost") || host === "[::1]" || host === "[::]" || host === "0.0.0.0" || /^127\.\d+\.\d+\.\d+$/.test(host))
185
+ return { passed: false, detail: "Local URLs such as localhost work during development." };
186
+ return { passed: true, detail: value };
187
+ }
188
+ function isProductionSiteUrlCheck(item) {
189
+ return item.id === "site-url" || item.id === "site-url-set";
190
+ }
191
+ const productionSiteUrlAction = "Before deploying, set site.url in nuxt.config.ts or set NUXT_SITE_URL in your deployment environment.";
192
+ const productionSiteUrlDocs = "https://nuxtseo.com/docs/site-config/guides/setting-site-config";
187
193
  const CHECKLIST_DEFINITIONS = {
188
194
  "site-config": [
189
195
  {
190
196
  id: "site-url",
191
- label: "Site URL configured",
192
- description: "A production site URL is needed for canonical URLs, sitemaps, and OG images to work correctly.",
197
+ label: "Production site URL",
198
+ description: "Use your live site URL for canonical URLs, sitemaps, and OG images.",
193
199
  level: "required",
194
- docsUrl: "https://nuxtseo.com/docs/site-config/getting-started/how-it-works",
195
- detect: (data) => {
196
- const url = data?.config?.url || "";
197
- const passed = isConfiguredUrl(data?.config, data?.stack);
198
- return { passed, detail: passed ? url : "Set a production site URL." };
199
- }
200
+ docsUrl: productionSiteUrlDocs,
201
+ detect: (data) => detectProductionSiteUrl(data.config, data.stack)
200
202
  },
201
203
  {
202
204
  id: "site-name",
@@ -228,15 +230,11 @@ const CHECKLIST_DEFINITIONS = {
228
230
  "sitemap": [
229
231
  {
230
232
  id: "site-url-set",
231
- label: "Site URL set for sitemaps",
232
- description: "Sitemaps require an absolute site URL. Without it, URLs will use localhost in production.",
233
+ label: "Production site URL for sitemaps",
234
+ description: "Use your live site URL for sitemap entries.",
233
235
  level: "required",
234
- docsUrl: "https://nuxtseo.com/docs/sitemap/getting-started/installation",
235
- detect: (data, ctx) => {
236
- const url = data?.siteConfig?.url || "";
237
- const passed = isConfiguredUrl(data?.siteConfig, ctx.debugData.get("site-config")?.stack);
238
- return { passed, detail: passed ? url : "Site URL not configured" };
239
- }
236
+ docsUrl: productionSiteUrlDocs,
237
+ detect: (data, ctx) => detectProductionSiteUrl(data.siteConfig, ctx.debugData.get("site-config")?.stack)
240
238
  },
241
239
  {
242
240
  id: "no-source-errors",
@@ -282,27 +280,28 @@ const AUTOMATIC_MODULES = {
282
280
  "skew-protection": { label: "Skew Protection", icon: "carbon:security" }
283
281
  };
284
282
  const SETUP_ACTIONS = {
285
- "site-url": "Set site.url to your production URL, for example https://example.com.",
286
- "site-url-set": "Set site.url to your production URL, for example https://example.com.",
283
+ "site-url": productionSiteUrlAction,
284
+ "site-url-set": productionSiteUrlAction,
287
285
  "site-name": "Set site.name to your site name.",
288
286
  "renderer": "Install your OG Image renderer dependencies, or set ogImage: false.",
289
287
  "no-validation-errors": "Correct the robots.txt errors shown in DevTools.",
290
288
  "no-source-errors": "Correct the failing sitemap sources shown in DevTools.",
291
- "app-secret": "Run npx nuxt-og-image generate-secret. Set NUXT_APP_SECRET in .env and in production, 32 characters or more."
289
+ "app-secret": "Set NUXT_APP_SECRET in production. Generate it with openssl rand -base64 32."
292
290
  };
293
291
  function evaluateContextChecks(slug, context) {
294
- if (slug !== "og-image" || !context?.ogImageSecret)
292
+ const secret = slug === "og-image" ? context?.ogImageSecret : slug === "ai-ready" ? context?.aiReadySecret : void 0;
293
+ if (!secret)
295
294
  return [];
296
- const passed = context.ogImageSecret === "configured";
295
+ const passed = secret === "configured";
297
296
  return [{
298
297
  id: "app-secret",
299
- label: "Signing secret set",
300
- description: "OG Image signs runtime image URLs with NUXT_APP_SECRET. Without it, production OG image requests return a 500 error. Pages still render.",
298
+ label: "Production secret configured",
299
+ description: slug === "og-image" ? "OG Image needs a production secret to sign image URLs. Without a valid secret, image requests return 500. Pages still render." : "AI Ready needs a production secret to authenticate protected Runtime Sync requests.",
301
300
  level: "required",
302
- docsUrl: "https://nuxtseo.com/docs/og-image/guides/security#url-signing",
301
+ docsUrl: "https://nuxt.com/docs/4.x/guide/going-further/runtime-config#application-secret",
303
302
  status: passed ? "passed" : "failed",
304
303
  passed,
305
- detail: passed ? "Configured" : "Nuxt generated a development secret. Production builds do not generate one.",
304
+ detail: passed ? "Configured" : "Local setup has no valid production secret.",
306
305
  action: SETUP_ACTIONS["app-secret"]
307
306
  }];
308
307
  }
@@ -351,7 +350,8 @@ function evaluateSetupChecklist(input) {
351
350
  }
352
351
  function formatSetupReport(results, options = {}) {
353
352
  const labels = { "configured": "Configured", "needs-setup": "Needs setup", "disabled": "Disabled", "unavailable": "Not checked", "automatic": "Automatic" };
354
- const lines = ["Nuxt SEO setup", ...results.map((result) => ` ${result.moduleLabel}: ${labels[result.status]}`)];
353
+ const summary = results.filter((result) => options.showSiteUrlReminder !== false || result.status !== "needs-setup" || result.items.some((item) => item.status === "failed" && item.level === "required" && !isProductionSiteUrlCheck(item)));
354
+ const lines = ["Nuxt SEO setup", ...summary.map((result) => ` ${result.moduleLabel}: ${labels[result.status]}`)];
355
355
  if (results.some((result) => result.status === "unavailable"))
356
356
  lines.push("", "Some module data was unavailable. Open DevTools to retry setup checks.");
357
357
  for (const [level, heading] of [["required", "Required setup:"], ["recommended", "Optional tips:"]]) {
@@ -359,7 +359,7 @@ function formatSetupReport(results, options = {}) {
359
359
  continue;
360
360
  const candidates = results.flatMap((result) => result.items.filter((item) => item.status === "failed" && item.level === level).map((item) => ({ moduleLabel: result.moduleLabel, item })));
361
361
  const hasSiteUrlFailure = candidates.some(({ item }) => item.id === "site-url");
362
- const eligible = candidates.filter(({ item }) => item.id !== "site-url-set" || !hasSiteUrlFailure);
362
+ const eligible = candidates.filter(({ item }) => !isProductionSiteUrlCheck(item) || options.showSiteUrlReminder !== false && (item.id === "site-url" || !hasSiteUrlFailure));
363
363
  const failures = eligible.slice(0, level === "recommended" ? 3 : void 0);
364
364
  if (!failures.length)
365
365
  continue;
@@ -372,4 +372,4 @@ function formatSetupReport(results, options = {}) {
372
372
  return lines.join("\n");
373
373
  }
374
374
 
375
- export { DEBUG_ENDPOINTS, DEVTOOLS_NAME_TO_SLUG, evaluateSetupChecklist, formatSetupReport, getSetupTipOptOuts, parseSetupChecklistContext };
375
+ export { DEBUG_ENDPOINTS, DEVTOOLS_NAME_TO_SLUG, evaluateSetupChecklist, formatSetupReport, getSetupTipOptOuts, isProductionSiteUrlCheck, parseSetupChecklistContext };
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^4.6.0 || ^5.0.0-0"
6
6
  },
7
- "version": "6.0.4",
7
+ "version": "6.0.5",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.3",
10
10
  "unbuild": "3.6.1"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxtseo-shared",
3
3
  "type": "module",
4
- "version": "6.0.4",
4
+ "version": "6.0.5",
5
5
  "description": "Shared utilities for Nuxt SEO modules.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",