nuxtseo-shared 5.3.7 → 5.3.9

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/dist/i18n.mjs CHANGED
@@ -112,6 +112,14 @@ function resolveI18nModule() {
112
112
  isMicro: found === "nuxt-i18n-micro"
113
113
  };
114
114
  }
115
+ function resolveI18nPages(config, isMicro) {
116
+ const routes = isMicro ? config.globalLocaleRoutes : config.pages;
117
+ if (!routes)
118
+ return void 0;
119
+ return Object.fromEntries(
120
+ Object.entries(routes).filter((entry) => typeof entry[1] === "object" && entry[1] !== null && !Array.isArray(entry[1]))
121
+ );
122
+ }
115
123
  async function resolveI18nConfig(logger) {
116
124
  const i18n = resolveI18nModule();
117
125
  if (!i18n)
@@ -124,7 +132,8 @@ async function resolveI18nConfig(logger) {
124
132
  }
125
133
  const nuxtI18nConfig = await getNuxtModuleOptions(i18n.module) || {};
126
134
  const normalisedLocales = normalizeLocales(nuxtI18nConfig);
127
- const usingI18nPages = Object.keys(nuxtI18nConfig.pages || {}).length;
135
+ const pages = resolveI18nPages(nuxtI18nConfig, i18n.isMicro);
136
+ const usingI18nPages = Object.keys(pages || {}).length;
128
137
  const hasI18nConfigForAlternatives = nuxtI18nConfig.differentDomains || usingI18nPages || nuxtI18nConfig.strategy !== "no_prefix" && nuxtI18nConfig.locales;
129
138
  if (!hasI18nConfigForAlternatives)
130
139
  return false;
@@ -133,7 +142,7 @@ async function resolveI18nConfig(logger) {
133
142
  defaultLocale: nuxtI18nConfig.defaultLocale,
134
143
  locales: normalisedLocales,
135
144
  strategy: nuxtI18nConfig.strategy,
136
- pages: nuxtI18nConfig.pages
145
+ pages
137
146
  };
138
147
  }
139
148
  function mergeOnKey(arr, key) {
package/dist/kit.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  import { pathToFileURL } from 'node:url';
2
- import { getNuxtVersion, addTypeTemplate, useNuxt, createResolver, addTemplate, loadNuxtModuleInstance, tryUseNuxt, hasNuxtModule, hasNuxtModuleCompatibility, useLogger } from '@nuxt/kit';
2
+ import { getNuxtVersion, addTypeTemplate, useNuxt, resolveModule, createResolver, addTemplate, loadNuxtModuleInstance, tryUseNuxt, hasNuxtModule, hasNuxtModuleCompatibility, useLogger } from '@nuxt/kit';
3
3
  import { relative, dirname } from 'pathe';
4
4
  import { resolvePackageJSON, readPackageJSON } from 'pkg-types';
5
5
  import { provider, env } from 'std-env';
6
6
 
7
7
  const NITRO_RUNTIME_MODULE = "#nuxtseo/nitro";
8
8
  const H3_RUNTIME_MODULE = "#nuxtseo/h3";
9
+ const OFETCH_RUNTIME_MODULE = "#nuxtseo/ofetch";
9
10
  const TYPE_TEMPLATE_FILENAME = "types/nuxtseo-nitro.d.ts";
10
11
  const legacySetupMarker = Symbol.for("nuxtseo:nitro-runtime-compatibility");
11
12
  const typeSetupMarker = Symbol.for("nuxtseo:nitro-runtime-compatibility:request-context-types");
@@ -35,8 +36,26 @@ const nitroV2Runtime = `export {
35
36
  defineTask,
36
37
  runTask,
37
38
  } from 'nitropack/runtime'
39
+ export function fetchWithEvent(event, request, options) {
40
+ return event.$fetch(request, options)
41
+ }
38
42
  `;
39
- const nitroV3Runtime = `export { definePlugin as defineNitroPlugin } from 'nitro'
43
+ const nitroV2RuntimeTypes = `export {
44
+ defineNitroPlugin,
45
+ useNitroApp,
46
+ useEvent,
47
+ useRuntimeConfig,
48
+ defineCachedFunction,
49
+ defineCachedEventHandler,
50
+ useStorage,
51
+ defineTask,
52
+ runTask,
53
+ } from 'nitropack/runtime'
54
+ export function fetchWithEvent<T>(event: import('h3').H3Event, request: import('ofetch').FetchRequest, options?: import('ofetch').FetchOptions): Promise<T>
55
+ `;
56
+ const nitroV3Runtime = `import { createFetch } from '${OFETCH_RUNTIME_MODULE}'
57
+ import { fetchWithEvent as fetchRawWithEvent } from 'nitro/h3'
58
+ export { definePlugin as defineNitroPlugin } from 'nitro'
40
59
  export { useNitroApp } from 'nitro/app'
41
60
  export { useRequest as useEvent } from 'nitro/context'
42
61
  import { useRuntimeConfig as _useRuntimeConfig } from 'nitro/runtime-config'
@@ -44,6 +63,12 @@ export function useRuntimeConfig(_event) { return _useRuntimeConfig() }
44
63
  export { defineCachedFunction, defineCachedHandler as defineCachedEventHandler } from 'nitro/cache'
45
64
  export { useStorage } from 'nitro/storage'
46
65
  export { defineTask, runTask } from 'nitro/task'
66
+ export function fetchWithEvent(event, request, options) {
67
+ const localFetch = createFetch({
68
+ fetch: (input, init) => fetchRawWithEvent(event, input, init),
69
+ })
70
+ return localFetch(request, options)
71
+ }
47
72
  `;
48
73
  const nitroV3RuntimeTypes = `export { definePlugin as defineNitroPlugin } from 'nitro'
49
74
  export { useNitroApp } from 'nitro/app'
@@ -52,6 +77,7 @@ export function useRuntimeConfig(event?: import('nitro/h3').H3Event): ReturnType
52
77
  export { defineCachedFunction, defineCachedHandler as defineCachedEventHandler } from 'nitro/cache'
53
78
  export { useStorage } from 'nitro/storage'
54
79
  export { defineTask, runTask } from 'nitro/task'
80
+ export function fetchWithEvent<T>(event: import('nitro/h3').H3Event, request: import('ofetch').FetchRequest, options?: import('ofetch').FetchOptions): Promise<T>
55
81
  `;
56
82
  function indent(value, spaces) {
57
83
  const padding = " ".repeat(spaces);
@@ -65,7 +91,7 @@ ${indent(contents.trim(), 4)}
65
91
  }`;
66
92
  }
67
93
  function renderRuntimeDeclarations(compatibility) {
68
- const nitroRuntime = compatibility._tag === "nitro-v3" ? nitroV3RuntimeTypes : nitroV2Runtime;
94
+ const nitroRuntime = compatibility._tag === "nitro-v3" ? nitroV3RuntimeTypes : nitroV2RuntimeTypes;
69
95
  const h3Runtime = compatibility._tag === "nitro-v3" ? `export * from 'nitro/h3'
70
96
  ` : `export * from 'h3'
71
97
  `;
@@ -84,6 +110,8 @@ function applyNitroRuntimeCompatibility(nuxt, compatibility) {
84
110
  nitroOptions.alias ||= {};
85
111
  nitroOptions.virtual ||= {};
86
112
  nitroOptions.alias[H3_RUNTIME_MODULE] = compatibility._tag === "nitro-v3" ? "nitro/h3" : "h3";
113
+ if (compatibility._tag === "nitro-v3")
114
+ nitroOptions.alias[OFETCH_RUNTIME_MODULE] = resolveModule("ofetch", { url: new URL(import.meta.url) });
87
115
  nitroOptions.virtual[NITRO_RUNTIME_MODULE] = compatibility._tag === "nitro-v3" ? nitroV3Runtime : nitroV2Runtime;
88
116
  }
89
117
  function renderNitroTypeAugmentations(compatibility, augmentations) {
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "5.3.7",
7
+ "version": "5.3.9",
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": "5.3.7",
4
+ "version": "5.3.9",
5
5
  "description": "Shared utilities for Nuxt SEO modules.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",