nuxtseo-shared 5.3.9 → 5.3.10

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/kit.mjs CHANGED
@@ -39,6 +39,9 @@ const nitroV2Runtime = `export {
39
39
  export function fetchWithEvent(event, request, options) {
40
40
  return event.$fetch(request, options)
41
41
  }
42
+ export function fetchRawWithEvent(event, request, init) {
43
+ return event.fetch(request, init)
44
+ }
42
45
  `;
43
46
  const nitroV2RuntimeTypes = `export {
44
47
  defineNitroPlugin,
@@ -52,9 +55,11 @@ const nitroV2RuntimeTypes = `export {
52
55
  runTask,
53
56
  } from 'nitropack/runtime'
54
57
  export function fetchWithEvent<T>(event: import('h3').H3Event, request: import('ofetch').FetchRequest, options?: import('ofetch').FetchOptions): Promise<T>
58
+ export function fetchRawWithEvent(event: import('h3').H3Event, request: RequestInfo | URL, init?: RequestInit): Promise<Response>
55
59
  `;
56
60
  const nitroV3Runtime = `import { createFetch } from '${OFETCH_RUNTIME_MODULE}'
57
- import { fetchWithEvent as fetchRawWithEvent } from 'nitro/h3'
61
+ import { fetchWithEvent as fetchH3WithEvent, getProxyRequestHeaders } from 'nitro/h3'
62
+ import { useNitroApp as _useNitroApp } from 'nitro/app'
58
63
  export { definePlugin as defineNitroPlugin } from 'nitro'
59
64
  export { useNitroApp } from 'nitro/app'
60
65
  export { useRequest as useEvent } from 'nitro/context'
@@ -63,9 +68,24 @@ export function useRuntimeConfig(_event) { return _useRuntimeConfig() }
63
68
  export { defineCachedFunction, defineCachedHandler as defineCachedEventHandler } from 'nitro/cache'
64
69
  export { useStorage } from 'nitro/storage'
65
70
  export { defineTask, runTask } from 'nitro/task'
71
+ function fetchRaw(event, input, init) {
72
+ if (typeof input !== 'string' || !input.startsWith('/'))
73
+ return fetchH3WithEvent(event, input, init)
74
+ const headers = new Headers(getProxyRequestHeaders(event, { host: true }))
75
+ for (const [name, value] of new Headers(init?.headers))
76
+ headers.set(name, value)
77
+ const request = new Request(new URL(input, event.url), { ...init, headers })
78
+ request.runtime = event.req.runtime
79
+ request.waitUntil = event.req.waitUntil
80
+ request.ip = event.req.ip
81
+ return _useNitroApp().fetch(request)
82
+ }
83
+ export function fetchRawWithEvent(event, request, init) {
84
+ return fetchRaw(event, request, init)
85
+ }
66
86
  export function fetchWithEvent(event, request, options) {
67
87
  const localFetch = createFetch({
68
- fetch: (input, init) => fetchRawWithEvent(event, input, init),
88
+ fetch: (input, init) => fetchRaw(event, input, init),
69
89
  })
70
90
  return localFetch(request, options)
71
91
  }
@@ -78,6 +98,7 @@ export { defineCachedFunction, defineCachedHandler as defineCachedEventHandler }
78
98
  export { useStorage } from 'nitro/storage'
79
99
  export { defineTask, runTask } from 'nitro/task'
80
100
  export function fetchWithEvent<T>(event: import('nitro/h3').H3Event, request: import('ofetch').FetchRequest, options?: import('ofetch').FetchOptions): Promise<T>
101
+ export function fetchRawWithEvent(event: import('nitro/h3').H3Event, request: RequestInfo | URL, init?: RequestInit): Promise<Response>
81
102
  `;
82
103
  function indent(value, spaces) {
83
104
  const padding = " ".repeat(spaces);
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "5.3.9",
7
+ "version": "5.3.10",
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.9",
4
+ "version": "5.3.10",
5
5
  "description": "Shared utilities for Nuxt SEO modules.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",