nuxtseo-shared 5.3.16 → 6.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.
@@ -0,0 +1,69 @@
1
+ import { NuxtSEOModule, ChecklistItemDefinition } from './const.mjs';
2
+
3
+ /** Preserve explicit opt-outs separately from module defaults. */
4
+ declare function getSetupTipOptOuts(slug: NuxtSEOModule['slug'], options: unknown): string[];
5
+ /** Parse safe configuration facts at the metadata boundary, preserving unknown values as unknown. */
6
+ declare function parseSetupChecklistContext(value: unknown): SetupChecklistContext | undefined;
7
+
8
+ interface ChecklistDetectResult {
9
+ passed: boolean;
10
+ detail?: string;
11
+ }
12
+ type ChecklistItemStatus = 'passed' | 'failed' | 'unavailable' | 'not-applicable';
13
+ type ModuleChecklistStatus = 'configured' | 'needs-setup' | 'disabled' | 'unavailable' | 'automatic';
14
+ interface ChecklistItemResult extends ChecklistItemDefinition {
15
+ status: ChecklistItemStatus;
16
+ action?: string;
17
+ passed: boolean;
18
+ detail?: string;
19
+ }
20
+ interface ModuleChecklistResult {
21
+ status: ModuleChecklistStatus;
22
+ moduleSlug: NuxtSEOModule['slug'];
23
+ moduleLabel: string;
24
+ moduleIcon: string;
25
+ items: ChecklistItemResult[];
26
+ requiredPending: number;
27
+ recommendedPending: number;
28
+ totalPending: number;
29
+ }
30
+ interface ChecklistSummary {
31
+ total: number;
32
+ passed: number;
33
+ requiredPending: number;
34
+ recommendedPending: number;
35
+ unavailable: number;
36
+ }
37
+ declare const DEBUG_ENDPOINTS: Partial<Record<NuxtSEOModule['slug'], string>>;
38
+ declare const DEVTOOLS_NAME_TO_SLUG: Record<string, NuxtSEOModule['slug']>;
39
+ interface SetupChecklistContext {
40
+ tipsEnabled?: boolean;
41
+ ssr: boolean;
42
+ hasI18n: boolean;
43
+ hasDynamicRoutes: boolean;
44
+ hasContent: boolean;
45
+ isPrerendered?: boolean;
46
+ hasPrerenderedRoutes?: boolean;
47
+ devtoolsEnabled?: boolean;
48
+ nuxtMajor?: number;
49
+ nitroPreset?: string;
50
+ sitemapPrerendered?: boolean;
51
+ hasSitemapOutputHook?: boolean;
52
+ optOuts?: Partial<Record<NuxtSEOModule['slug'], string[]>>;
53
+ moduleOptions?: Partial<Record<NuxtSEOModule['slug'], Record<string, unknown>>>;
54
+ }
55
+ interface SetupChecklistInput {
56
+ installedModuleSlugs: Set<NuxtSEOModule['slug']>;
57
+ debugData: Map<NuxtSEOModule['slug'], Record<string, any>>;
58
+ disabledModuleSlugs?: Set<NuxtSEOModule['slug']>;
59
+ context?: SetupChecklistContext;
60
+ }
61
+ /** Evaluate resolved module evidence without fetching endpoints or mutating application state. */
62
+ declare function evaluateSetupChecklist(input: SetupChecklistInput): ModuleChecklistResult[];
63
+ /** Terminal output uses the same evidence and severity as the DevTools checklist. */
64
+ declare function formatSetupReport(results: ModuleChecklistResult[], options?: {
65
+ showTips?: boolean;
66
+ }): string;
67
+
68
+ export { DEBUG_ENDPOINTS, DEVTOOLS_NAME_TO_SLUG, evaluateSetupChecklist, formatSetupReport, getSetupTipOptOuts, parseSetupChecklistContext };
69
+ export type { ChecklistDetectResult, ChecklistItemResult, ChecklistItemStatus, ChecklistSummary, ModuleChecklistResult, ModuleChecklistStatus, SetupChecklistContext, SetupChecklistInput };
@@ -0,0 +1,69 @@
1
+ import { NuxtSEOModule, ChecklistItemDefinition } from './const.js';
2
+
3
+ /** Preserve explicit opt-outs separately from module defaults. */
4
+ declare function getSetupTipOptOuts(slug: NuxtSEOModule['slug'], options: unknown): string[];
5
+ /** Parse safe configuration facts at the metadata boundary, preserving unknown values as unknown. */
6
+ declare function parseSetupChecklistContext(value: unknown): SetupChecklistContext | undefined;
7
+
8
+ interface ChecklistDetectResult {
9
+ passed: boolean;
10
+ detail?: string;
11
+ }
12
+ type ChecklistItemStatus = 'passed' | 'failed' | 'unavailable' | 'not-applicable';
13
+ type ModuleChecklistStatus = 'configured' | 'needs-setup' | 'disabled' | 'unavailable' | 'automatic';
14
+ interface ChecklistItemResult extends ChecklistItemDefinition {
15
+ status: ChecklistItemStatus;
16
+ action?: string;
17
+ passed: boolean;
18
+ detail?: string;
19
+ }
20
+ interface ModuleChecklistResult {
21
+ status: ModuleChecklistStatus;
22
+ moduleSlug: NuxtSEOModule['slug'];
23
+ moduleLabel: string;
24
+ moduleIcon: string;
25
+ items: ChecklistItemResult[];
26
+ requiredPending: number;
27
+ recommendedPending: number;
28
+ totalPending: number;
29
+ }
30
+ interface ChecklistSummary {
31
+ total: number;
32
+ passed: number;
33
+ requiredPending: number;
34
+ recommendedPending: number;
35
+ unavailable: number;
36
+ }
37
+ declare const DEBUG_ENDPOINTS: Partial<Record<NuxtSEOModule['slug'], string>>;
38
+ declare const DEVTOOLS_NAME_TO_SLUG: Record<string, NuxtSEOModule['slug']>;
39
+ interface SetupChecklistContext {
40
+ tipsEnabled?: boolean;
41
+ ssr: boolean;
42
+ hasI18n: boolean;
43
+ hasDynamicRoutes: boolean;
44
+ hasContent: boolean;
45
+ isPrerendered?: boolean;
46
+ hasPrerenderedRoutes?: boolean;
47
+ devtoolsEnabled?: boolean;
48
+ nuxtMajor?: number;
49
+ nitroPreset?: string;
50
+ sitemapPrerendered?: boolean;
51
+ hasSitemapOutputHook?: boolean;
52
+ optOuts?: Partial<Record<NuxtSEOModule['slug'], string[]>>;
53
+ moduleOptions?: Partial<Record<NuxtSEOModule['slug'], Record<string, unknown>>>;
54
+ }
55
+ interface SetupChecklistInput {
56
+ installedModuleSlugs: Set<NuxtSEOModule['slug']>;
57
+ debugData: Map<NuxtSEOModule['slug'], Record<string, any>>;
58
+ disabledModuleSlugs?: Set<NuxtSEOModule['slug']>;
59
+ context?: SetupChecklistContext;
60
+ }
61
+ /** Evaluate resolved module evidence without fetching endpoints or mutating application state. */
62
+ declare function evaluateSetupChecklist(input: SetupChecklistInput): ModuleChecklistResult[];
63
+ /** Terminal output uses the same evidence and severity as the DevTools checklist. */
64
+ declare function formatSetupReport(results: ModuleChecklistResult[], options?: {
65
+ showTips?: boolean;
66
+ }): string;
67
+
68
+ export { DEBUG_ENDPOINTS, DEVTOOLS_NAME_TO_SLUG, evaluateSetupChecklist, formatSetupReport, getSetupTipOptOuts, parseSetupChecklistContext };
69
+ export type { ChecklistDetectResult, ChecklistItemResult, ChecklistItemStatus, ChecklistSummary, ModuleChecklistResult, ModuleChecklistStatus, SetupChecklistContext, SetupChecklistInput };
@@ -0,0 +1,354 @@
1
+ const OPTION_PATHS = {
2
+ "site-config": ["enabled"],
3
+ "robots": ["enabled"],
4
+ "schema-org": ["enabled"],
5
+ "skew-protection": ["enabled"],
6
+ "sitemap": ["enabled", "zeroRuntime", "zeroPrerender", "minify", "experimentalStreaming"],
7
+ "og-image": ["enabled", "zeroRuntime", "buildCache"],
8
+ "seo-utils": ["enabled"],
9
+ "ai-ready": ["enabled", "contentNegotiation", "llmsTxt.markdownLinks", "runtimeSync", "cron", "database.type"],
10
+ "link-checker": ["enabled", "showLiveInspections", "runOnBuild", "failOnError"]
11
+ };
12
+ function record(value) {
13
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
14
+ }
15
+ function pathValue(value, path) {
16
+ return path.split(".").reduce((current, key) => record(current)?.[key], value);
17
+ }
18
+ function getSetupTipOptOuts(slug, options) {
19
+ return (OPTION_PATHS[slug] || []).filter((path) => path.split(".").some((_, index, keys) => pathValue(options, keys.slice(0, index + 1).join(".")) === false));
20
+ }
21
+ function parseSetupChecklistContext(value) {
22
+ const data = record(value);
23
+ if (!data || !["ssr", "hasI18n", "hasDynamicRoutes", "hasContent"].every((key) => typeof data[key] === "boolean"))
24
+ return;
25
+ const context = {
26
+ ssr: data.ssr,
27
+ hasI18n: data.hasI18n,
28
+ hasDynamicRoutes: data.hasDynamicRoutes,
29
+ hasContent: data.hasContent,
30
+ moduleOptions: {},
31
+ optOuts: {}
32
+ };
33
+ for (const key of ["tipsEnabled", "isPrerendered", "hasPrerenderedRoutes", "devtoolsEnabled", "sitemapPrerendered", "hasSitemapOutputHook"]) {
34
+ if (typeof data[key] === "boolean")
35
+ context[key] = data[key];
36
+ }
37
+ if (typeof data.nuxtMajor === "number" && Number.isInteger(data.nuxtMajor) && data.nuxtMajor > 0)
38
+ context.nuxtMajor = data.nuxtMajor;
39
+ if (typeof data.nitroPreset === "string" && /^[\w-]+$/.test(data.nitroPreset))
40
+ context.nitroPreset = data.nitroPreset;
41
+ for (const [slug, paths] of Object.entries(OPTION_PATHS)) {
42
+ const options = record(record(data.moduleOptions)?.[slug]);
43
+ const selected = {};
44
+ let valid = true;
45
+ for (const path of paths) {
46
+ let option = pathValue(options, path);
47
+ if (option === void 0)
48
+ continue;
49
+ if ((path === "buildCache" || path === "runtimeSync") && record(option))
50
+ option = true;
51
+ const validOption = path === "database.type" ? typeof option === "string" && ["none", "sqlite", "bun", "d1", "libsql", "neon", "postgres"].includes(option) : typeof option === "boolean";
52
+ if (!validOption) {
53
+ valid = false;
54
+ break;
55
+ }
56
+ const [key, child] = path.split(".");
57
+ if (child) {
58
+ if (!record(selected[key]))
59
+ selected[key] = {};
60
+ selected[key][child] = option;
61
+ } else {
62
+ selected[key] = option;
63
+ }
64
+ }
65
+ if (valid && Object.keys(selected).length)
66
+ context.moduleOptions[slug] = selected;
67
+ const optOuts = record(data.optOuts)?.[slug];
68
+ if (Array.isArray(optOuts))
69
+ context.optOuts[slug] = optOuts.filter((path) => typeof path === "string" && paths.includes(path));
70
+ }
71
+ return context;
72
+ }
73
+ function sourceUrls(data) {
74
+ if (!Array.isArray(data?.globalSources) || !record(data?.sitemaps))
75
+ return;
76
+ const sources = [...data.globalSources, ...Object.values(data.sitemaps).flatMap((sitemap) => Array.isArray(sitemap?.sources) ? sitemap.sources : [])];
77
+ const urls = /* @__PURE__ */ new Set();
78
+ for (const source of sources) {
79
+ if (!record(source) || source.error || source._isFailure || !Array.isArray(source.urls))
80
+ return;
81
+ for (const url of source.urls) {
82
+ const loc = typeof url === "string" ? url : record(url)?.loc;
83
+ if (typeof loc === "string" && (loc.startsWith("/") || URL.canParse(loc)))
84
+ urls.add(loc);
85
+ }
86
+ }
87
+ return urls;
88
+ }
89
+ function evaluateSetupTips(slug, input) {
90
+ const context = input.context;
91
+ if (!context || context.tipsEnabled === false || input.disabledModuleSlugs?.has(slug))
92
+ return [];
93
+ const options = context.moduleOptions?.[slug];
94
+ if (!options || options.enabled === false)
95
+ return [];
96
+ const tips = [];
97
+ const add = (path, id, label, detail, action, description, docs) => {
98
+ if (context.optOuts?.[slug]?.includes(path))
99
+ return;
100
+ tips.push({ id, label, detail, action, description, docsUrl: `https://nuxtseo.com/docs/${docs}`, level: "recommended", status: "failed", passed: false });
101
+ };
102
+ const staticApp = context.ssr && context.isPrerendered === true && !context.hasDynamicRoutes;
103
+ const runtimeApp = context.ssr && context.isPrerendered === false;
104
+ if (slug === "sitemap") {
105
+ const data = input.debugData.get(slug);
106
+ const urls = sourceUrls(data);
107
+ const sources = [...data?.globalSources || [], ...Object.values(data?.sitemaps || {}).flatMap((sitemap) => sitemap.sources || [])];
108
+ const hasRuntimeSources = sources.some((source) => source.sourceType === "user" || typeof source.context?.name === "string" && !source.context.name.startsWith("nuxt:"));
109
+ if (staticApp && options.zeroRuntime === false && options.zeroPrerender !== true && urls && !hasRuntimeSources)
110
+ add("zeroRuntime", "zero-runtime", "Prerender sitemaps without runtime handlers", "Your app uses static generation and only app URL sources.", "Consider sitemap: { zeroRuntime: true } if all sitemap URLs are known at build time.", "This removes sitemap runtime code. Sitemap URLs then update only during builds.", "sitemap/guides/zero-runtime");
111
+ if (urls && urls.size >= 1e3 && options.minify === false)
112
+ add("minify", "sitemap-minify", "Minify large sitemaps", `Your sitemap sources contain ${urls.size} distinct URL candidates.`, "Consider sitemap: { minify: true }.", "Minification reduces XML bytes. Raw XML becomes harder to inspect.", "sitemap/api/config#minify-boolean");
113
+ if (urls && urls.size >= 1e4 && runtimeApp && context.nuxtMajor !== void 0 && context.nuxtMajor < 5 && context.nitroPreset === "node-server" && context.sitemapPrerendered === false && context.hasSitemapOutputHook === false && options.zeroRuntime !== true && options.experimentalStreaming === false)
114
+ add("experimentalStreaming", "sitemap-streaming", "Stream large runtime sitemaps", `Your Node sitemap sources contain ${urls.size} distinct URL candidates.`, "Consider sitemap: { experimentalStreaming: true }.", "Streaming reduces XML serialization memory. Sources still resolve in memory. This feature is experimental.", "sitemap/advanced/performance");
115
+ }
116
+ if (slug === "og-image") {
117
+ const data = input.debugData.get(slug);
118
+ const hasAppTemplate = Array.isArray(data?.componentNames) && data.componentNames.some((component) => component?.category === "app");
119
+ if (staticApp && hasAppTemplate && options.zeroRuntime !== true)
120
+ add("zeroRuntime", "og-zero-runtime", "Prerender OG images without runtime rendering", "Your static app has a custom OG Image template.", "Consider ogImage: { zeroRuntime: true } if every OG image page is prerendered.", "This removes runtime renderer code. Pages without prerendering receive no generated OG image.", "og-image/guides/zero-runtime");
121
+ if (context.ssr && (staticApp || context.hasPrerenderedRoutes === true) && hasAppTemplate && options.buildCache === false)
122
+ add("buildCache", "og-build-cache", "Reuse OG images between builds", "Your app prerenders pages and has a custom OG Image template.", "Consider ogImage: { buildCache: true }.", "The cache reuses unchanged images. Persist its directory in CI to reuse images between jobs.", "og-image/guides/build-cache");
123
+ }
124
+ if (slug === "link-checker") {
125
+ if (context.devtoolsEnabled === true && options.showLiveInspections === false)
126
+ add("showLiveInspections", "live-inspections", "Inspect links while browsing", "Nuxt DevTools is enabled in your app.", "Consider linkChecker: { showLiveInspections: true }.", "Live inspections show link results while browsing. They add development checks and overlays.", "link-checker/guides/live-inspections");
127
+ if (context.ssr && (context.isPrerendered === true || context.hasPrerenderedRoutes === true) && options.runOnBuild === true && options.failOnError === false)
128
+ add("failOnError", "fail-on-link-errors", "Stop builds on broken prerendered links", "Your app scans prerendered pages during builds.", "Consider linkChecker: { failOnError: true }.", "Scanned link errors then stop builds. Existing link errors can block deployment.", "link-checker/guides/build-scans");
129
+ }
130
+ if (slug === "ai-ready") {
131
+ if (runtimeApp && options.contentNegotiation === false && record(options.llmsTxt)?.markdownLinks !== true)
132
+ add("llmsTxt.markdownLinks", "markdown-links", "Link directly to Markdown pages", "Your app disables AI content negotiation.", "Consider aiReady: { llmsTxt: { markdownLinks: true } }.", "Agents can follow direct Markdown links. Generated links then point to Markdown instead of HTML.", "ai-ready/guides/llms-txt");
133
+ if (runtimeApp && (context.hasDynamicRoutes || context.hasContent) && options.runtimeSync !== true && options.cron !== true && ["d1", "libsql", "neon", "postgres"].includes(String(record(options.database)?.type)))
134
+ add("runtimeSync", "runtime-sync", "Discover new sitemap pages between builds", "Your server app has dynamic content and a persistent database type.", "If new pages appear between deployments, consider aiReady: { runtimeSync: true }.", "Sync fetches new pages in the background. Configure database access and polling. Existing pages need reindexing.", "ai-ready/guides/runtime-indexing");
135
+ }
136
+ return tips;
137
+ }
138
+
139
+ const DEBUG_ENDPOINTS = {
140
+ "site-config": "/__site-config__/debug.json",
141
+ "robots": "/__robots__/debug.json",
142
+ "sitemap": "/__sitemap__/debug.json",
143
+ "og-image": "/_og/debug.json"
144
+ };
145
+ const DEVTOOLS_NAME_TO_SLUG = {
146
+ "nuxt-robots": "robots",
147
+ "sitemap": "sitemap",
148
+ "nuxt-og-image": "og-image",
149
+ "nuxt-schema-org": "schema-org",
150
+ "nuxt-seo-utils": "seo-utils",
151
+ "nuxt-link-checker": "link-checker",
152
+ "nuxt-site-config": "site-config",
153
+ "nuxt-ai-ready": "ai-ready",
154
+ "nuxt-skew-protection": "skew-protection"
155
+ };
156
+ const MODULE_META = {
157
+ "site-config": { label: "Site Config", icon: "carbon:settings-check" },
158
+ "robots": { label: "Robots", icon: "carbon:bot" },
159
+ "sitemap": { label: "Sitemap", icon: "carbon:load-balancer-application" },
160
+ "og-image": { label: "OG Image", icon: "carbon:image-search" },
161
+ "seo-utils": { label: "SEO Utils", icon: "carbon:tools" },
162
+ "schema-org": { label: "Schema.org", icon: "carbon:chart-relationship" }
163
+ };
164
+ function isValidUrl(value) {
165
+ if (typeof value !== "string")
166
+ return false;
167
+ if (!URL.canParse(value))
168
+ return false;
169
+ const url = new URL(value);
170
+ if (!["http:", "https:"].includes(url.protocol))
171
+ return false;
172
+ const host = url.hostname.toLowerCase();
173
+ return host !== "localhost" && !host.endsWith(".localhost") && host !== "[::1]" && host !== "0.0.0.0" && !host.startsWith("127.");
174
+ }
175
+ function isConfiguredUrl(config, stack) {
176
+ if (!isValidUrl(config?.url))
177
+ return false;
178
+ if (typeof config?._context?.url === "string")
179
+ return config._context.url !== "nitro:init";
180
+ if (config?._priority?.url === -4) {
181
+ return Array.isArray(stack) && stack.some((entry) => entry && typeof entry.url === "string" && entry.url.trim() && (entry._priority ?? 0) > -4);
182
+ }
183
+ return true;
184
+ }
185
+ const CHECKLIST_DEFINITIONS = {
186
+ "site-config": [
187
+ {
188
+ id: "site-url",
189
+ label: "Site URL configured",
190
+ description: "A production site URL is needed for canonical URLs, sitemaps, and OG images to work correctly.",
191
+ level: "required",
192
+ docsUrl: "https://nuxtseo.com/docs/site-config/getting-started/how-it-works",
193
+ detect: (data) => {
194
+ const url = data?.config?.url || "";
195
+ const passed = isConfiguredUrl(data?.config, data?.stack);
196
+ return { passed, detail: passed ? url : "Set a production site URL." };
197
+ }
198
+ },
199
+ {
200
+ id: "site-name",
201
+ label: "Site name set",
202
+ description: "Used for default meta tags, Schema.org, and OG tags across all modules.",
203
+ level: "required",
204
+ docsUrl: "https://nuxtseo.com/docs/site-config/getting-started/how-it-works",
205
+ detect: (data) => {
206
+ const name = data?.config?.name || "";
207
+ const passed = !!name && name !== "My Site";
208
+ return { passed, detail: passed ? name : "Not configured" };
209
+ }
210
+ }
211
+ ],
212
+ "robots": [
213
+ {
214
+ id: "no-validation-errors",
215
+ label: "No robots.txt validation errors",
216
+ description: "Your robots.txt should be free of syntax errors that could confuse crawlers.",
217
+ level: "required",
218
+ docsUrl: "https://nuxtseo.com/docs/robots/getting-started/installation",
219
+ detect: (data) => {
220
+ const errors = data?.validation?.errors || [];
221
+ const passed = errors.length === 0;
222
+ return { passed, detail: passed ? "No errors" : `${errors.length} error(s) found` };
223
+ }
224
+ }
225
+ ],
226
+ "sitemap": [
227
+ {
228
+ id: "site-url-set",
229
+ label: "Site URL set for sitemaps",
230
+ description: "Sitemaps require an absolute site URL. Without it, URLs will use localhost in production.",
231
+ level: "required",
232
+ docsUrl: "https://nuxtseo.com/docs/sitemap/getting-started/installation",
233
+ detect: (data, ctx) => {
234
+ const url = data?.siteConfig?.url || "";
235
+ const passed = isConfiguredUrl(data?.siteConfig, ctx.debugData.get("site-config")?.stack);
236
+ return { passed, detail: passed ? url : "Site URL not configured" };
237
+ }
238
+ },
239
+ {
240
+ id: "no-source-errors",
241
+ label: "No sitemap source errors",
242
+ description: "All configured sitemap sources should resolve successfully.",
243
+ level: "required",
244
+ docsUrl: "https://nuxtseo.com/docs/sitemap/guides/dynamic-urls",
245
+ detect: (data) => {
246
+ const sources = data?.globalSources || [];
247
+ const sitemaps = data?.sitemaps || {};
248
+ const allSources = [
249
+ ...sources,
250
+ ...Object.values(sitemaps).flatMap((s) => s.sources || [])
251
+ ];
252
+ const failures = allSources.filter((s) => s._isFailure || s.error);
253
+ const passed = failures.length === 0;
254
+ return { passed, detail: passed ? "All sources OK" : `${failures.length} source(s) failing` };
255
+ }
256
+ }
257
+ ],
258
+ "og-image": [
259
+ {
260
+ id: "renderer",
261
+ label: "Renderer installed",
262
+ description: "A renderer (Takumi, Satori, or Browser) is required to generate OG images.",
263
+ level: "required",
264
+ docsUrl: "https://nuxtseo.com/docs/og-image/getting-started/installation",
265
+ detect: (data) => {
266
+ const compat = data?.compatibility || {};
267
+ const hasTakumi = compat.takumi && compat.takumi !== false;
268
+ const hasSatori = compat.satori && compat.satori !== false;
269
+ const hasBrowser = compat.browser && compat.browser !== false;
270
+ const passed = hasTakumi || hasSatori || hasBrowser;
271
+ const renderers = [hasTakumi && "takumi", hasSatori && "satori", hasBrowser && "browser"].filter(Boolean);
272
+ return { passed, detail: passed ? `Available: ${renderers.join(", ")}` : "No renderer installed" };
273
+ }
274
+ }
275
+ ]
276
+ };
277
+ const AUTOMATIC_MODULES = {
278
+ "link-checker": { label: "Link Checker", icon: "carbon:find" },
279
+ "ai-ready": { label: "AI Ready", icon: "carbon:bot" },
280
+ "skew-protection": { label: "Skew Protection", icon: "carbon:security" }
281
+ };
282
+ const SETUP_ACTIONS = {
283
+ "site-url": "Set site.url to your production URL, for example https://example.com.",
284
+ "site-url-set": "Set site.url to your production URL, for example https://example.com.",
285
+ "site-name": "Set site.name to your site name.",
286
+ "renderer": "Install your OG Image renderer dependencies, or set ogImage: false.",
287
+ "no-validation-errors": "Correct the robots.txt errors shown in DevTools.",
288
+ "no-source-errors": "Correct the failing sitemap sources shown in DevTools."
289
+ };
290
+ function hasEvidence(slug, item, data) {
291
+ if (!data)
292
+ return false;
293
+ if (slug === "site-config")
294
+ return !!data.config && typeof data.config === "object";
295
+ if (slug === "robots") {
296
+ return !(typeof data.robotsTxt === "string" && /^\s*(?:<!doctype\s+html|<html\b)/i.test(data.robotsTxt)) && Array.isArray(data.validation?.errors) && Array.isArray(data.validation?.sitemaps);
297
+ }
298
+ if (slug === "sitemap") {
299
+ if (item.id === "site-url-set")
300
+ return !!data.siteConfig && typeof data.siteConfig === "object";
301
+ return Array.isArray(data.globalSources) && data.globalSources.every((source) => source !== null && typeof source === "object") && !!data.sitemaps && typeof data.sitemaps === "object" && Object.values(data.sitemaps).every((sitemap) => sitemap !== null && typeof sitemap === "object" && (!sitemap.sources || Array.isArray(sitemap.sources) && sitemap.sources.every((source) => source !== null && typeof source === "object")));
302
+ }
303
+ if (slug === "og-image")
304
+ return item.id === "renderer" ? !!data.compatibility && typeof data.compatibility === "object" : Array.isArray(data.componentNames);
305
+ return true;
306
+ }
307
+ function evaluateSetupChecklist(input) {
308
+ const orderedSlugs = ["site-config", "robots", "sitemap", "og-image", "schema-org", "seo-utils", "link-checker", "ai-ready", "skew-protection"];
309
+ const ctx = { installedModuleSlugs: input.installedModuleSlugs, debugData: input.debugData };
310
+ return orderedSlugs.filter((slug) => input.installedModuleSlugs.has(slug) || input.disabledModuleSlugs?.has(slug)).map((slug) => {
311
+ const meta = MODULE_META[slug] || AUTOMATIC_MODULES[slug];
312
+ const data = input.debugData.get(slug);
313
+ const disabled = input.disabledModuleSlugs?.has(slug) === true;
314
+ const items = (CHECKLIST_DEFINITIONS[slug] || []).map((def) => {
315
+ const { detect, ...definition } = def;
316
+ if (disabled)
317
+ return { ...definition, status: "not-applicable", passed: false };
318
+ if (!hasEvidence(slug, def, data))
319
+ return { ...definition, status: "unavailable", passed: false, detail: "Setup could not be checked." };
320
+ const result = detect(data, ctx);
321
+ return { ...definition, ...result, status: result.passed ? "passed" : "failed", action: SETUP_ACTIONS[def.id] };
322
+ });
323
+ const requiredPending = items.filter((item) => item.level === "required" && item.status === "failed").length;
324
+ const status = disabled ? "disabled" : requiredPending ? "needs-setup" : items.some((item) => item.status === "unavailable") ? "unavailable" : !items.length || items.every((item) => item.status === "not-applicable") ? "automatic" : "configured";
325
+ if (status === "configured" || status === "automatic")
326
+ items.push(...evaluateSetupTips(slug, input));
327
+ const recommendedPending = items.filter((item) => item.level === "recommended" && item.status === "failed").length;
328
+ return { moduleSlug: slug, moduleLabel: meta.label, moduleIcon: meta.icon, items, requiredPending, recommendedPending, totalPending: requiredPending + recommendedPending, status };
329
+ });
330
+ }
331
+ function formatSetupReport(results, options = {}) {
332
+ const labels = { "configured": "Configured", "needs-setup": "Needs setup", "disabled": "Disabled", "unavailable": "Not checked", "automatic": "Automatic" };
333
+ const lines = ["Nuxt SEO setup", ...results.map((result) => ` ${result.moduleLabel}: ${labels[result.status]}`)];
334
+ if (results.some((result) => result.status === "unavailable"))
335
+ lines.push("", "Some module data was unavailable. Open DevTools to retry setup checks.");
336
+ for (const [level, heading] of [["required", "Required setup:"], ["recommended", "Optional tips:"]]) {
337
+ if (level === "recommended" && options.showTips === false)
338
+ continue;
339
+ const candidates = results.flatMap((result) => result.items.filter((item) => item.status === "failed" && item.level === level).map((item) => ({ moduleLabel: result.moduleLabel, item })));
340
+ const hasSiteUrlFailure = candidates.some(({ item }) => item.id === "site-url");
341
+ const eligible = candidates.filter(({ item }) => item.id !== "site-url-set" || !hasSiteUrlFailure);
342
+ const failures = eligible.slice(0, level === "recommended" ? 3 : void 0);
343
+ if (!failures.length)
344
+ continue;
345
+ lines.push("", heading);
346
+ for (const { moduleLabel, item } of failures)
347
+ lines.push(` ${moduleLabel}: ${item.label}. ${item.detail || ""}`, ` ${item.action || item.description}`, ...item.action ? [` ${item.description}`] : [], ` ${item.docsUrl}`);
348
+ if (level === "recommended" && eligible.length > failures.length)
349
+ lines.push(` More optional tips: ${eligible.length - failures.length}. Open DevTools to see all tips.`);
350
+ }
351
+ return lines.join("\n");
352
+ }
353
+
354
+ export { DEBUG_ENDPOINTS, DEVTOOLS_NAME_TO_SLUG, evaluateSetupChecklist, formatSetupReport, getSetupTipOptOuts, parseSetupChecklistContext };
package/dist/const.d.mts CHANGED
@@ -34,8 +34,6 @@ declare const bundledModules: NuxtSEOModule[];
34
34
  declare const standaloneModules: NuxtSEOModule[];
35
35
  /** @deprecated Use `bundledModules` */
36
36
  declare const normalModules: NuxtSEOModule[];
37
- /** @deprecated Use `standaloneModules` */
38
- declare const proModules: NuxtSEOModule[];
39
37
 
40
- export { AiReadyModule, LinkCheckerModule, NuxtSEO, OgImageModule, RobotsModule, SchemaOrgModule, SeoUtilsModule, SiteConfigModule, SitemapModule, SkewProtectionModule, bundledModules, modules, normalModules, proModules, standaloneModules };
38
+ export { AiReadyModule, LinkCheckerModule, NuxtSEO, OgImageModule, RobotsModule, SchemaOrgModule, SeoUtilsModule, SiteConfigModule, SitemapModule, SkewProtectionModule, bundledModules, modules, normalModules, standaloneModules };
41
39
  export type { ChecklistItemDefinition, ChecklistItemLevel, NuxtSEOModule };
package/dist/const.d.ts CHANGED
@@ -34,8 +34,6 @@ declare const bundledModules: NuxtSEOModule[];
34
34
  declare const standaloneModules: NuxtSEOModule[];
35
35
  /** @deprecated Use `bundledModules` */
36
36
  declare const normalModules: NuxtSEOModule[];
37
- /** @deprecated Use `standaloneModules` */
38
- declare const proModules: NuxtSEOModule[];
39
37
 
40
- export { AiReadyModule, LinkCheckerModule, NuxtSEO, OgImageModule, RobotsModule, SchemaOrgModule, SeoUtilsModule, SiteConfigModule, SitemapModule, SkewProtectionModule, bundledModules, modules, normalModules, proModules, standaloneModules };
38
+ export { AiReadyModule, LinkCheckerModule, NuxtSEO, OgImageModule, RobotsModule, SchemaOrgModule, SeoUtilsModule, SiteConfigModule, SitemapModule, SkewProtectionModule, bundledModules, modules, normalModules, standaloneModules };
41
39
  export type { ChecklistItemDefinition, ChecklistItemLevel, NuxtSEOModule };
package/dist/const.mjs CHANGED
@@ -105,7 +105,7 @@ const SchemaOrgModule = {
105
105
  const SkewProtectionModule = {
106
106
  slug: "skew-protection",
107
107
  npm: "nuxt-skew-protection",
108
- repo: "nuxt-seo-pro/nuxt-skew-protection",
108
+ repo: "harlan-zw/nuxt-skew-protection",
109
109
  description: "Solve Nuxt version skews with persistent assets and instant updates.",
110
110
  label: "Skew Protection",
111
111
  icon: "i-carbon-version"
@@ -113,7 +113,7 @@ const SkewProtectionModule = {
113
113
  const AiReadyModule = {
114
114
  slug: "ai-ready",
115
115
  npm: "nuxt-ai-ready",
116
- repo: "nuxt-seo-pro/nuxt-ai-ready",
116
+ repo: "harlan-zw/nuxt-ai-ready",
117
117
  description: "Best practice AI & LLM discoverability for Nuxt sites.",
118
118
  label: "AI Ready",
119
119
  icon: "i-carbon-ai-label"
@@ -136,13 +136,11 @@ const bundledModules = [
136
136
  OgImageModule,
137
137
  SchemaOrgModule,
138
138
  LinkCheckerModule,
139
- SeoUtilsModule
140
- ];
141
- const standaloneModules = [
139
+ SeoUtilsModule,
142
140
  SkewProtectionModule,
143
141
  AiReadyModule
144
142
  ];
143
+ const standaloneModules = [];
145
144
  const normalModules = bundledModules;
146
- const proModules = standaloneModules;
147
145
 
148
- export { AiReadyModule, LinkCheckerModule, NuxtSEO, OgImageModule, RobotsModule, SchemaOrgModule, SeoUtilsModule, SiteConfigModule, SitemapModule, SkewProtectionModule, bundledModules, modules, normalModules, proModules, standaloneModules };
146
+ export { AiReadyModule, LinkCheckerModule, NuxtSEO, OgImageModule, RobotsModule, SchemaOrgModule, SeoUtilsModule, SiteConfigModule, SitemapModule, SkewProtectionModule, bundledModules, modules, normalModules, standaloneModules };
@@ -1,36 +1,33 @@
1
1
  import { Resolver } from '@nuxt/kit';
2
- import { BirpcGroup } from 'birpc';
3
- export { BirpcGroup } from 'birpc';
4
2
  import { Nuxt } from 'nuxt/schema';
5
3
 
6
- /** Origin-root route the assembled (layer-mode) devtools client is served from. */
7
4
  declare const UNIFIED_CLIENT_ROUTE = "/__nuxt-seo-devtools";
8
5
  interface DevToolsUIConfig {
9
- /** Per-module route used by the legacy prebuilt-client mode. */
10
6
  route?: string;
11
7
  name: string;
12
8
  title: string;
13
9
  icon: string;
14
- /** Route segment inside the unified client (layer mode). Defaults to name minus `nuxt-`. */
15
10
  slug?: string;
16
- /** Legacy dev-proxy port (prebuilt-client mode only). */
17
11
  devPort?: number;
18
12
  }
19
13
  interface SeoModuleInfo {
20
14
  name: string;
21
- /** npm package name — the stable identifier the client matches installed state on. */
15
+ disabled?: boolean;
22
16
  npm?: string;
23
17
  title: string;
24
18
  icon: string;
25
19
  route: string;
26
20
  }
27
- /**
28
- * Register a module's devtools panel. Detects whether the module ships a source layer
29
- * (current) or a prebuilt client (legacy) and handles each, so old and new modules can
30
- * be mixed during migration.
31
- */
21
+ type Broadcast<F> = F extends (...args: infer A) => infer R ? ((...args: A) => Promise<Awaited<R>[]>) & {
22
+ asEvent: (...args: A) => void;
23
+ } : never;
24
+ interface BirpcGroup<ClientFunctions extends object, _ServerFunctions extends object = object> {
25
+ broadcast: {
26
+ [K in keyof ClientFunctions]: Broadcast<ClientFunctions[K]>;
27
+ };
28
+ }
32
29
  declare function setupDevToolsUI(config: DevToolsUIConfig, resolve: Resolver['resolve'], nuxt?: Nuxt): void;
33
- declare function setupDevToolsRpc<ServerFunctions extends object, ClientFunctions extends object>(namespace: string, serverFunctions: ServerFunctions, nuxt?: Nuxt): Promise<BirpcGroup<ClientFunctions, ServerFunctions>>;
30
+ declare function setupDevToolsRpc<S extends object, C extends object>(namespace: string, functions: S, nuxt?: Nuxt): Promise<BirpcGroup<C, S> | undefined>;
34
31
 
35
32
  export { UNIFIED_CLIENT_ROUTE, setupDevToolsRpc, setupDevToolsUI };
36
- export type { DevToolsUIConfig, SeoModuleInfo };
33
+ export type { BirpcGroup, DevToolsUIConfig, SeoModuleInfo };
@@ -1,36 +1,33 @@
1
1
  import { Resolver } from '@nuxt/kit';
2
- import { BirpcGroup } from 'birpc';
3
- export { BirpcGroup } from 'birpc';
4
2
  import { Nuxt } from 'nuxt/schema';
5
3
 
6
- /** Origin-root route the assembled (layer-mode) devtools client is served from. */
7
4
  declare const UNIFIED_CLIENT_ROUTE = "/__nuxt-seo-devtools";
8
5
  interface DevToolsUIConfig {
9
- /** Per-module route used by the legacy prebuilt-client mode. */
10
6
  route?: string;
11
7
  name: string;
12
8
  title: string;
13
9
  icon: string;
14
- /** Route segment inside the unified client (layer mode). Defaults to name minus `nuxt-`. */
15
10
  slug?: string;
16
- /** Legacy dev-proxy port (prebuilt-client mode only). */
17
11
  devPort?: number;
18
12
  }
19
13
  interface SeoModuleInfo {
20
14
  name: string;
21
- /** npm package name — the stable identifier the client matches installed state on. */
15
+ disabled?: boolean;
22
16
  npm?: string;
23
17
  title: string;
24
18
  icon: string;
25
19
  route: string;
26
20
  }
27
- /**
28
- * Register a module's devtools panel. Detects whether the module ships a source layer
29
- * (current) or a prebuilt client (legacy) and handles each, so old and new modules can
30
- * be mixed during migration.
31
- */
21
+ type Broadcast<F> = F extends (...args: infer A) => infer R ? ((...args: A) => Promise<Awaited<R>[]>) & {
22
+ asEvent: (...args: A) => void;
23
+ } : never;
24
+ interface BirpcGroup<ClientFunctions extends object, _ServerFunctions extends object = object> {
25
+ broadcast: {
26
+ [K in keyof ClientFunctions]: Broadcast<ClientFunctions[K]>;
27
+ };
28
+ }
32
29
  declare function setupDevToolsUI(config: DevToolsUIConfig, resolve: Resolver['resolve'], nuxt?: Nuxt): void;
33
- declare function setupDevToolsRpc<ServerFunctions extends object, ClientFunctions extends object>(namespace: string, serverFunctions: ServerFunctions, nuxt?: Nuxt): Promise<BirpcGroup<ClientFunctions, ServerFunctions>>;
30
+ declare function setupDevToolsRpc<S extends object, C extends object>(namespace: string, functions: S, nuxt?: Nuxt): Promise<BirpcGroup<C, S> | undefined>;
34
31
 
35
32
  export { UNIFIED_CLIENT_ROUTE, setupDevToolsRpc, setupDevToolsUI };
36
- export type { DevToolsUIConfig, SeoModuleInfo };
33
+ export type { BirpcGroup, DevToolsUIConfig, SeoModuleInfo };