nuxtseo-shared 6.0.3 → 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/devtools.mjs CHANGED
@@ -1,12 +1,13 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { readFileSync } from 'node:fs';
3
- import { createRequire, findPackageJSON } from 'node:module';
3
+ import { createRequire } from 'node:module';
4
4
  import { join } from 'node:path';
5
5
  import { pathToFileURL } from 'node:url';
6
6
  import { useNuxt, useLogger, getAddDependencyCommand } from '@nuxt/kit';
7
+ import { f as findPackageJSON } from './shared/nuxtseo-shared.UXA9u2O3.mjs';
7
8
 
8
9
  const UNIFIED_CLIENT_ROUTE = "/__nuxt-seo-devtools";
9
- const HOST_PACKAGE = "nuxtseo-devtools-host@^1.0.1";
10
+ const HOST_PACKAGE = "nuxtseo-devtools-host@^1.0.3";
10
11
  function loadHost(nuxt) {
11
12
  const require = createRequire(join(nuxt.options.rootDir, "package.json"));
12
13
  let entry;
package/dist/i18n.mjs CHANGED
@@ -3,10 +3,12 @@ import { withHttps, withBase } from 'ufo';
3
3
  import { localePath, resolveLocaleAlternates, resolveI18nDomain, resolveLocaleFromRoute } from './i18n-runtime.mjs';
4
4
  import { getNuxtModuleOptions } from './kit.mjs';
5
5
  import 'node:fs/promises';
6
- import 'node:module';
7
6
  import 'node:path';
8
7
  import 'node:url';
9
8
  import 'std-env';
9
+ import './shared/nuxtseo-shared.UXA9u2O3.mjs';
10
+ import 'node:fs';
11
+ import 'node:module';
10
12
 
11
13
  const I18N_MODULES = ["@nuxtjs/i18n", "nuxt-i18n-micro"];
12
14
  function isUnlocalizedLocalePage(page) {
package/dist/kit.d.mts CHANGED
@@ -28,6 +28,13 @@ interface NitroTypeAugmentations {
28
28
  declare function renderNitroTypeAugmentations(compatibility: NitroRuntimeCompatibility, augmentations: NitroTypeAugmentations): string;
29
29
  declare function setupNitroRuntimeCompatibility(nuxt?: Nuxt): NitroRuntimeCompatibility;
30
30
 
31
+ /**
32
+ * `module.findPackageJSON()` with a fallback for runtimes that do not implement it (Bun).
33
+ *
34
+ * Throws an error with code `ERR_MODULE_NOT_FOUND` when the target cannot be found.
35
+ */
36
+ declare function findPackageJSON(specifier: string | URL, base?: string | URL): string | undefined;
37
+
31
38
  type RuntimeAliasOptions = {
32
39
  namespace: `#${string}`;
33
40
  } & ({
@@ -139,5 +146,5 @@ declare function hasContentFileHooks(provider: ContentProvider): boolean;
139
146
  */
140
147
  declare function setupContentRuntime(provider: ContentProvider, nuxt?: Nuxt): void;
141
148
 
142
- export { COMARK_CONTENT_MODULE, createNitroPromise, createPagesPromise, detectNuxtSeoModules, detectTarget, extendTypes, getNuxtModuleOptions, hasContentFileHooks, isNuxtGenerate, renderNitroTypeAugmentations, resolveContentProvider, resolveNitroPreset, resolveNuxtContentVersion, resolvePackageMajor, setupContentRuntime, setupNitroRuntimeCompatibility, setupRuntimeAliases, useModuleLogger };
149
+ export { COMARK_CONTENT_MODULE, createNitroPromise, createPagesPromise, detectNuxtSeoModules, detectTarget, extendTypes, findPackageJSON, getNuxtModuleOptions, hasContentFileHooks, isNuxtGenerate, renderNitroTypeAugmentations, resolveContentProvider, resolveNitroPreset, resolveNuxtContentVersion, resolvePackageMajor, setupContentRuntime, setupNitroRuntimeCompatibility, setupRuntimeAliases, useModuleLogger };
143
150
  export type { ContentProvider, NitroRuntimeCompatibility, NitroTypeAugmentations, NuxtContentVersion, NuxtSeoModuleDetection, RuntimeAliasOptions };
package/dist/kit.d.ts CHANGED
@@ -28,6 +28,13 @@ interface NitroTypeAugmentations {
28
28
  declare function renderNitroTypeAugmentations(compatibility: NitroRuntimeCompatibility, augmentations: NitroTypeAugmentations): string;
29
29
  declare function setupNitroRuntimeCompatibility(nuxt?: Nuxt): NitroRuntimeCompatibility;
30
30
 
31
+ /**
32
+ * `module.findPackageJSON()` with a fallback for runtimes that do not implement it (Bun).
33
+ *
34
+ * Throws an error with code `ERR_MODULE_NOT_FOUND` when the target cannot be found.
35
+ */
36
+ declare function findPackageJSON(specifier: string | URL, base?: string | URL): string | undefined;
37
+
31
38
  type RuntimeAliasOptions = {
32
39
  namespace: `#${string}`;
33
40
  } & ({
@@ -139,5 +146,5 @@ declare function hasContentFileHooks(provider: ContentProvider): boolean;
139
146
  */
140
147
  declare function setupContentRuntime(provider: ContentProvider, nuxt?: Nuxt): void;
141
148
 
142
- export { COMARK_CONTENT_MODULE, createNitroPromise, createPagesPromise, detectNuxtSeoModules, detectTarget, extendTypes, getNuxtModuleOptions, hasContentFileHooks, isNuxtGenerate, renderNitroTypeAugmentations, resolveContentProvider, resolveNitroPreset, resolveNuxtContentVersion, resolvePackageMajor, setupContentRuntime, setupNitroRuntimeCompatibility, setupRuntimeAliases, useModuleLogger };
149
+ export { COMARK_CONTENT_MODULE, createNitroPromise, createPagesPromise, detectNuxtSeoModules, detectTarget, extendTypes, findPackageJSON, getNuxtModuleOptions, hasContentFileHooks, isNuxtGenerate, renderNitroTypeAugmentations, resolveContentProvider, resolveNitroPreset, resolveNuxtContentVersion, resolvePackageMajor, setupContentRuntime, setupNitroRuntimeCompatibility, setupRuntimeAliases, useModuleLogger };
143
150
  export type { ContentProvider, NitroRuntimeCompatibility, NitroTypeAugmentations, NuxtContentVersion, NuxtSeoModuleDetection, RuntimeAliasOptions };
package/dist/kit.mjs CHANGED
@@ -1,10 +1,12 @@
1
1
  import { readFile } from 'node:fs/promises';
2
- import { findPackageJSON } from 'node:module';
3
2
  import { isAbsolute, resolve, relative, sep, join } from 'node:path';
4
3
  import { pathToFileURL } from 'node:url';
5
4
  import { getNitroVersion, addTypeTemplate, useNuxt, useLogger, resolveModule, directoryToURL, createResolver, addTemplate, loadNuxtModuleInstance, hasNuxtModule, tryUseNuxt, hasNuxtModuleCompatibility } from '@nuxt/kit';
6
5
  import { provider, env } from 'std-env';
7
6
  export { isAgent, isCI } from 'std-env';
7
+ import { f as findPackageJSON } from './shared/nuxtseo-shared.UXA9u2O3.mjs';
8
+ import 'node:fs';
9
+ import 'node:module';
8
10
 
9
11
  const NITRO_RUNTIME_MODULE = "#nuxtseo/nitro";
10
12
  const H3_RUNTIME_MODULE = "#nuxtseo/h3";
@@ -277,7 +279,7 @@ function normalizePackageUrl(rootDir) {
277
279
  }
278
280
  async function readPackageVersion(id, rootDir) {
279
281
  const path = await Promise.resolve().then(() => findPackageJSON(id, new URL("package.json", normalizePackageUrl(rootDir)))).catch((error) => {
280
- if (error && typeof error === "object" && "code" in error && (error.code === "ERR_MODULE_NOT_FOUND" || error.code === "ENOENT"))
282
+ if (error && typeof error === "object" && "code" in error && (error.code === "ERR_MODULE_NOT_FOUND" || error.code === "MODULE_NOT_FOUND" || error.code === "ENOENT"))
281
283
  return void 0;
282
284
  throw error;
283
285
  });
@@ -462,4 +464,4 @@ function setupContentRuntime(provider2, nuxt = useNuxt()) {
462
464
  }
463
465
  }
464
466
 
465
- export { COMARK_CONTENT_MODULE, createNitroPromise, createPagesPromise, detectNuxtSeoModules, detectTarget, extendTypes, getNuxtModuleOptions, hasContentFileHooks, isNuxtGenerate, renderNitroTypeAugmentations, resolveContentProvider, resolveNitroPreset, resolveNuxtContentVersion, resolvePackageMajor, setupContentRuntime, setupNitroRuntimeCompatibility, setupRuntimeAliases, useModuleLogger };
467
+ export { COMARK_CONTENT_MODULE, createNitroPromise, createPagesPromise, detectNuxtSeoModules, detectTarget, extendTypes, findPackageJSON, getNuxtModuleOptions, hasContentFileHooks, isNuxtGenerate, renderNitroTypeAugmentations, resolveContentProvider, resolveNitroPreset, resolveNuxtContentVersion, resolvePackageMajor, setupContentRuntime, setupNitroRuntimeCompatibility, setupRuntimeAliases, useModuleLogger };
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.3",
7
+ "version": "6.0.5",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.3",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -4,9 +4,11 @@ import 'ofetch';
4
4
  import 'std-env';
5
5
  import './kit.mjs';
6
6
  import 'node:fs/promises';
7
- import 'node:module';
8
7
  import 'node:path';
9
8
  import 'node:url';
9
+ import './shared/nuxtseo-shared.UXA9u2O3.mjs';
10
+ import 'node:fs';
11
+ import 'node:module';
10
12
 
11
13
  const module$1 = defineNuxtModule({
12
14
  meta: {
package/dist/pro.mjs CHANGED
@@ -3,9 +3,11 @@ import { $fetch } from 'ofetch';
3
3
  import { isTest } from 'std-env';
4
4
  import { detectNuxtSeoModules } from './kit.mjs';
5
5
  import 'node:fs/promises';
6
- import 'node:module';
7
6
  import 'node:path';
8
7
  import 'node:url';
8
+ import './shared/nuxtseo-shared.UXA9u2O3.mjs';
9
+ import 'node:fs';
10
+ import 'node:module';
9
11
 
10
12
  function hookNuxtSeoProDataUpload() {
11
13
  const nuxt = useNuxt();
@@ -0,0 +1,102 @@
1
+ import { existsSync, statSync, readFileSync } from 'node:fs';
2
+ import * as nodeModule from 'node:module';
3
+ import { isAbsolute, dirname, join, sep } from 'node:path';
4
+ import { pathToFileURL, fileURLToPath } from 'node:url';
5
+
6
+ const URL_SCHEME_RE = /^[a-z][a-z\d+.-]*:/i;
7
+ function moduleNotFound(message, cause) {
8
+ return Object.assign(new Error(message, { cause }), { code: "ERR_MODULE_NOT_FOUND" });
9
+ }
10
+ function toBaseUrl(base) {
11
+ if (base instanceof URL)
12
+ return base;
13
+ return base.startsWith("file:") ? new URL(base) : pathToFileURL(base);
14
+ }
15
+ function isBareSpecifier(specifier) {
16
+ return !specifier.startsWith(".") && !isAbsolute(specifier) && !URL_SCHEME_RE.test(specifier);
17
+ }
18
+ function packageName(specifier) {
19
+ const [scope, name] = specifier.split("/");
20
+ return specifier.startsWith("@") ? `${scope}/${name}` : scope;
21
+ }
22
+ function readName(path) {
23
+ try {
24
+ const name = JSON.parse(readFileSync(path, "utf8")).name;
25
+ return typeof name === "string" ? name : void 0;
26
+ } catch {
27
+ return void 0;
28
+ }
29
+ }
30
+ function nearestPackageJSON(from) {
31
+ let dir = from;
32
+ while (true) {
33
+ const candidate = join(dir, "package.json");
34
+ if (existsSync(candidate))
35
+ return candidate;
36
+ const parent = dirname(dir);
37
+ if (parent === dir)
38
+ return void 0;
39
+ dir = parent;
40
+ }
41
+ }
42
+ function packageRootJSON(entry, name) {
43
+ const suffix = `${sep}node_modules${sep}${name.split("/").join(sep)}`;
44
+ let nearest;
45
+ let dir = dirname(entry);
46
+ while (true) {
47
+ const candidate = join(dir, "package.json");
48
+ if (existsSync(candidate)) {
49
+ nearest ||= candidate;
50
+ if (dir.endsWith(suffix) || readName(candidate) === name)
51
+ return candidate;
52
+ }
53
+ const parent = dirname(dir);
54
+ if (parent === dir)
55
+ return nearest;
56
+ dir = parent;
57
+ }
58
+ }
59
+ function lookupNodeModules(name, basePath) {
60
+ let dir = dirname(basePath);
61
+ while (true) {
62
+ const candidate = join(dir, "node_modules", name, "package.json");
63
+ if (existsSync(candidate))
64
+ return candidate;
65
+ const parent = dirname(dir);
66
+ if (parent === dir)
67
+ return void 0;
68
+ dir = parent;
69
+ }
70
+ }
71
+ function findPackageJSONFallback(specifier, base) {
72
+ const id = specifier instanceof URL ? specifier.href : specifier;
73
+ if (!isBareSpecifier(id)) {
74
+ if (base === void 0 && !isAbsolute(id) && !id.startsWith("file:"))
75
+ throw new TypeError(`A base is required to resolve the relative specifier "${id}".`);
76
+ const url = isAbsolute(id) ? pathToFileURL(id) : new URL(id, base === void 0 ? void 0 : toBaseUrl(base));
77
+ if (url.protocol !== "file:")
78
+ throw Object.assign(new TypeError("The URL must be of scheme file"), { code: "ERR_INVALID_URL_SCHEME" });
79
+ const target = fileURLToPath(url);
80
+ if (!existsSync(target))
81
+ throw moduleNotFound(`Cannot find module '${target}'`);
82
+ return nearestPackageJSON(statSync(target).isDirectory() ? target : dirname(target));
83
+ }
84
+ if (base === void 0)
85
+ throw new TypeError(`A base is required to resolve the bare specifier "${id}".`);
86
+ const basePath = fileURLToPath(toBaseUrl(base));
87
+ const name = packageName(id);
88
+ try {
89
+ return packageRootJSON(nodeModule.createRequire(basePath).resolve(name), name);
90
+ } catch (error) {
91
+ const found = lookupNodeModules(name, basePath);
92
+ if (found)
93
+ return found;
94
+ throw moduleNotFound(`Cannot find package '${name}' imported from ${basePath}`, error);
95
+ }
96
+ }
97
+ const nativeFindPackageJSON = nodeModule.findPackageJSON;
98
+ function findPackageJSON(specifier, base) {
99
+ return typeof nativeFindPackageJSON === "function" ? nativeFindPackageJSON(specifier, base) : findPackageJSONFallback(specifier, base);
100
+ }
101
+
102
+ export { findPackageJSON as f };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxtseo-shared",
3
3
  "type": "module",
4
- "version": "6.0.3",
4
+ "version": "6.0.5",
5
5
  "description": "Shared utilities for Nuxt SEO modules.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",