@nuxt/scripts 1.0.0-beta.6 → 1.0.0-beta.7

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.
@@ -1 +1 @@
1
- {"id":"762d443a-0880-424f-bda8-2b32b39d43ec","timestamp":1772420315053}
1
+ {"id":"9b4fb16a-3c62-48b0-8295-126cb077b5d3","timestamp":1772545181116}
@@ -0,0 +1 @@
1
+ {"id":"9b4fb16a-3c62-48b0-8295-126cb077b5d3","timestamp":1772545181116,"prerendered":[]}
@@ -1 +1 @@
1
- import{_ as o,c as s,o as a,a as t,t as r}from"./CBbMDhE2.js";import{u as i}from"./BpR-tlZc.js";const u={class:"antialiased bg-white dark:bg-[#020420] dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-[#020420] tracking-wide"},l={class:"max-w-520px text-center"},c=["textContent"],d=["textContent"],p=["textContent"],f={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},status:{type:Number,default:500},statusText:{type:String,default:"Internal server error"},description:{type:String,default:"This page is temporarily unavailable."},refresh:{type:String,default:"Refresh this page"}},setup(e){const n=e;return i({title:`${n.status} - ${n.statusText} | ${n.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver(e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(h,m)=>(a(),s("div",u,[t("div",l,[t("h1",{class:"font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]",textContent:r(e.status)},null,8,c),t("h2",{class:"font-semibold mb-2 sm:text-3xl text-2xl",textContent:r(e.statusText)},null,8,d),t("p",{class:"mb-4 px-2 text-[#64748B] text-md",textContent:r(e.description)},null,8,p)])]))}},x=o(f,[["__scopeId","data-v-2367f596"]]);export{x as default};
1
+ import{_ as o,c as s,o as a,a as t,t as r}from"./DaI2y8Uz.js";import{u as i}from"./Ci5iXYuB.js";const u={class:"antialiased bg-white dark:bg-[#020420] dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-[#020420] tracking-wide"},l={class:"max-w-520px text-center"},c=["textContent"],d=["textContent"],p=["textContent"],f={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},status:{type:Number,default:500},statusText:{type:String,default:"Internal server error"},description:{type:String,default:"This page is temporarily unavailable."},refresh:{type:String,default:"Refresh this page"}},setup(e){const n=e;return i({title:`${n.status} - ${n.statusText} | ${n.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver(e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1,h2{font-size:inherit;font-weight:inherit}h1,h2,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(h,m)=>(a(),s("div",u,[t("div",l,[t("h1",{class:"font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]",textContent:r(e.status)},null,8,c),t("h2",{class:"font-semibold mb-2 sm:text-3xl text-2xl",textContent:r(e.statusText)},null,8,d),t("p",{class:"mb-4 px-2 text-[#64748B] text-md",textContent:r(e.description)},null,8,p)])]))}},x=o(f,[["__scopeId","data-v-2367f596"]]);export{x as default};
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.D45OuV0w.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CBbMDhE2.js"><script type="module" src="/__nuxt-scripts/_nuxt/CBbMDhE2.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:""}},app:{baseURL:"/__nuxt-scripts",buildId:"762d443a-0880-424f-bda8-2b32b39d43ec",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1772420319607,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.D45OuV0w.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DaI2y8Uz.js"><script type="module" src="/__nuxt-scripts/_nuxt/DaI2y8Uz.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:""}},app:{baseURL:"/__nuxt-scripts",buildId:"9b4fb16a-3c62-48b0-8295-126cb077b5d3",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1772545185572,false]</script></body></html>
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16"
6
6
  },
7
- "version": "1.0.0-beta.6",
7
+ "version": "1.0.0-beta.7",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -234,10 +234,12 @@ function buildProxyConfig(collectPrefix) {
234
234
  // Reddit: untrusted ad network — full anonymization
235
235
  privacy: { ip: true, userAgent: true, language: true, screen: true, timezone: true, hardware: true },
236
236
  rewrite: [
237
- { from: "alb.reddit.com", to: `${collectPrefix}/reddit` }
237
+ { from: "alb.reddit.com", to: `${collectPrefix}/reddit` },
238
+ { from: "pixel-config.reddit.com", to: `${collectPrefix}/reddit-cfg` }
238
239
  ],
239
240
  routes: {
240
- [`${collectPrefix}/reddit/**`]: { proxy: "https://alb.reddit.com/**" }
241
+ [`${collectPrefix}/reddit/**`]: { proxy: "https://alb.reddit.com/**" },
242
+ [`${collectPrefix}/reddit-cfg/**`]: { proxy: "https://pixel-config.reddit.com/**" }
241
243
  }
242
244
  },
243
245
  clarity: {
@@ -559,10 +561,8 @@ function normalizeScriptData(src, assetsBaseURL = "/_scripts") {
559
561
  if (hasProtocol(src, { acceptRelative: true })) {
560
562
  src = src.replace(/^\/\//, "https://");
561
563
  const url = parseURL(src);
562
- const file = [
563
- `${hash(url)}.js`
564
- // force an extension
565
- ].filter(Boolean).join("-");
564
+ const h = hash(url);
565
+ const file = `${h.startsWith("-") ? `_${h.slice(1)}` : h}.js`;
566
566
  const nuxt = tryUseNuxt();
567
567
  const cdnURL = nuxt?.options.runtimeConfig?.app?.cdnURL || nuxt?.options.app?.cdnURL || "";
568
568
  const baseURL = cdnURL || nuxt?.options.app.baseURL || "";
package/dist/registry.mjs CHANGED
@@ -67,7 +67,10 @@ async function registry(resolve) {
67
67
  label: "Rybbit Analytics",
68
68
  proxy: "rybbit",
69
69
  category: "analytics",
70
- logo: `https://www.rybbit.io/rybbit.png`,
70
+ logo: {
71
+ light: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 263.33 173.53" width="37.24" height="32"><g><polygon fill="#0a3a3a" points="181.28 171.2 227.21 123.96 261.15 171.2 181.28 171.2"/><path fill="#0a3a3a" d="M261.15,89.05L206.64,2.33l-33.22,17.75-34.61-7.4c2.88,5.56,4.56,12.11,4.56,19.15,0,20.03-13.46,36.26-30.06,36.26-13.66,0-25.17-11-28.83-26.06l-39.92,71.46L2.18,94.19l22.66,77.01h55.81l22.28-54.01v54.01h64.66l-49.95-82.15h143.51Z"/></g><ellipse fill="#0a3a3a" cx="105.94" cy="28.62" rx="12.9" ry="18.88"/></svg>`,
72
+ dark: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 263.33 173.53" width="37.24" height="32"><g><polygon fill="#2fd381" points="181.28 171.2 227.21 123.96 261.15 171.2 181.28 171.2"/><path fill="#2fd381" d="M261.15,89.05L206.64,2.33l-33.22,17.75-34.61-7.4c2.88,5.56,4.56,12.11,4.56,19.15,0,20.03-13.46,36.26-30.06,36.26-13.66,0-25.17-11-28.83-26.06l-39.92,71.46L2.18,94.19l22.66,77.01h55.81l22.28-54.01v54.01h64.66l-49.95-82.15h143.51Z"/></g><ellipse fill="#2fd381" cx="105.94" cy="28.62" rx="12.9" ry="18.88"/></svg>`
73
+ },
71
74
  import: {
72
75
  name: "useScriptRybbitAnalytics",
73
76
  from: await resolve("./runtime/registry/rybbit-analytics")
@@ -5,7 +5,7 @@ export declare const PostHogOptions: import("valibot").ObjectSchema<{
5
5
  readonly region: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"us", undefined>, import("valibot").LiteralSchema<"eu", undefined>], undefined>, undefined>;
6
6
  readonly apiHost: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
7
7
  readonly autocapture: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
8
- readonly capturePageview: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
8
+ readonly capturePageview: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").BooleanSchema<undefined>, import("valibot").LiteralSchema<"history_change", undefined>], undefined>, undefined>;
9
9
  readonly capturePageleave: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
10
10
  readonly disableSessionRecording: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
11
11
  readonly config: import("valibot").OptionalSchema<import("valibot").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").AnySchema, undefined>, undefined>;
@@ -6,7 +6,7 @@ export const PostHogOptions = object({
6
6
  region: optional(union([literal("us"), literal("eu")])),
7
7
  apiHost: optional(string()),
8
8
  autocapture: optional(boolean()),
9
- capturePageview: optional(boolean()),
9
+ capturePageview: optional(union([boolean(), literal("history_change")])),
10
10
  capturePageleave: optional(boolean()),
11
11
  disableSessionRecording: optional(boolean()),
12
12
  config: optional(record(string(), any()))
@@ -58,7 +58,7 @@ export function useScriptPostHog(_options) {
58
58
  };
59
59
  if (typeof options?.autocapture === "boolean")
60
60
  config.autocapture = options.autocapture;
61
- if (typeof options?.capturePageview === "boolean")
61
+ if (typeof options?.capturePageview === "boolean" || options?.capturePageview === "history_change")
62
62
  config.capture_pageview = options.capturePageview;
63
63
  if (typeof options?.capturePageleave === "boolean")
64
64
  config.capture_pageleave = options.capturePageleave;
@@ -1,4 +1,4 @@
1
- import { defineEventHandler, getHeaders, getRequestIP, readBody, getQuery, setResponseHeader, createError } from "h3";
1
+ import { defineEventHandler, getHeaders, getRequestIP, readBody, getRequestWebStream, getQuery, setResponseHeader, createError } from "h3";
2
2
  import { useRuntimeConfig } from "#imports";
3
3
  import { useNitroApp } from "nitropack/runtime";
4
4
  import {
@@ -65,6 +65,12 @@ export default defineEventHandler(async (event) => {
65
65
  const perScriptResolved = resolvePrivacy(perScriptInput ?? true);
66
66
  const privacy = globalPrivacy !== void 0 ? mergePrivacy(perScriptResolved, globalPrivacy) : perScriptResolved;
67
67
  const anyPrivacy = privacy.ip || privacy.userAgent || privacy.language || privacy.screen || privacy.timezone || privacy.hardware;
68
+ const originalHeaders = getHeaders(event);
69
+ const contentType = originalHeaders["content-type"] || "";
70
+ const compressionParam = new URL(event.path, "http://localhost").searchParams.get("compression");
71
+ const isBinaryBody = Boolean(
72
+ originalHeaders["content-encoding"] || contentType.includes("octet-stream") || compressionParam && /gzip|deflate|br|compress|base64/i.test(compressionParam)
73
+ );
68
74
  let targetPath = path.slice(matchedPrefix.length);
69
75
  if (targetPath && !targetPath.startsWith("/")) {
70
76
  targetPath = "/" + targetPath;
@@ -78,13 +84,16 @@ export default defineEventHandler(async (event) => {
78
84
  targetUrl = strippedQuery ? `${basePath}?${strippedQuery}` : basePath;
79
85
  }
80
86
  }
81
- const originalHeaders = getHeaders(event);
82
87
  const headers = {};
83
88
  for (const [key, value] of Object.entries(originalHeaders)) {
84
89
  if (!value) continue;
85
90
  const lowerKey = key.toLowerCase();
86
91
  if (SENSITIVE_HEADERS.includes(lowerKey)) continue;
87
- if (anyPrivacy && lowerKey === "content-length") continue;
92
+ if (lowerKey === "content-length") {
93
+ if (anyPrivacy && !isBinaryBody) continue;
94
+ headers[lowerKey] = value;
95
+ continue;
96
+ }
88
97
  if (lowerKey === "x-forwarded-for" || lowerKey === "x-real-ip" || lowerKey === "forwarded" || lowerKey === "cf-connecting-ip" || lowerKey === "true-client-ip" || lowerKey === "x-client-ip" || lowerKey === "x-cluster-client-ip") {
89
98
  if (privacy.ip) continue;
90
99
  headers[lowerKey] = value;
@@ -123,47 +132,58 @@ export default defineEventHandler(async (event) => {
123
132
  }
124
133
  let body;
125
134
  let rawBody;
126
- const contentType = originalHeaders["content-type"] || "";
135
+ let passthroughBody = false;
127
136
  const method = event.method?.toUpperCase();
128
137
  const originalQuery = getQuery(event);
129
- if (method === "POST" || method === "PUT" || method === "PATCH") {
130
- rawBody = await readBody(event);
131
- if (anyPrivacy && rawBody) {
132
- if (typeof rawBody === "object") {
133
- body = stripPayloadFingerprinting(rawBody, privacy);
134
- } else if (typeof rawBody === "string") {
135
- if (rawBody.startsWith("{") || rawBody.startsWith("[")) {
136
- let parsed = null;
137
- try {
138
- parsed = JSON.parse(rawBody);
139
- } catch {
140
- }
141
- if (parsed && typeof parsed === "object") {
142
- body = stripPayloadFingerprinting(parsed, privacy);
138
+ const isWriteMethod = method === "POST" || method === "PUT" || method === "PATCH";
139
+ if (isWriteMethod) {
140
+ if (isBinaryBody || !anyPrivacy) {
141
+ passthroughBody = true;
142
+ } else {
143
+ rawBody = await readBody(event);
144
+ if (rawBody != null) {
145
+ if (Array.isArray(rawBody)) {
146
+ body = rawBody.map(
147
+ (item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
148
+ );
149
+ } else if (typeof rawBody === "object") {
150
+ body = stripPayloadFingerprinting(rawBody, privacy);
151
+ } else if (typeof rawBody === "string") {
152
+ if (rawBody.startsWith("{") || rawBody.startsWith("[")) {
153
+ let parsed = null;
154
+ try {
155
+ parsed = JSON.parse(rawBody);
156
+ } catch {
157
+ }
158
+ if (Array.isArray(parsed)) {
159
+ body = parsed.map(
160
+ (item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
161
+ );
162
+ } else if (parsed && typeof parsed === "object") {
163
+ body = stripPayloadFingerprinting(parsed, privacy);
164
+ } else {
165
+ body = rawBody;
166
+ }
167
+ } else if (contentType.includes("application/x-www-form-urlencoded")) {
168
+ const params = new URLSearchParams(rawBody);
169
+ const obj = {};
170
+ params.forEach((value, key) => {
171
+ obj[key] = value;
172
+ });
173
+ const stripped = stripPayloadFingerprinting(obj, privacy);
174
+ const stringified = {};
175
+ for (const [k, v] of Object.entries(stripped)) {
176
+ if (v === void 0 || v === null) continue;
177
+ stringified[k] = typeof v === "string" ? v : JSON.stringify(v);
178
+ }
179
+ body = new URLSearchParams(stringified).toString();
143
180
  } else {
144
181
  body = rawBody;
145
182
  }
146
- } else if (contentType.includes("application/x-www-form-urlencoded")) {
147
- const params = new URLSearchParams(rawBody);
148
- const obj = {};
149
- params.forEach((value, key) => {
150
- obj[key] = value;
151
- });
152
- const stripped = stripPayloadFingerprinting(obj, privacy);
153
- const stringified = {};
154
- for (const [k, v] of Object.entries(stripped)) {
155
- if (v === void 0 || v === null) continue;
156
- stringified[k] = typeof v === "string" ? v : JSON.stringify(v);
157
- }
158
- body = new URLSearchParams(stringified).toString();
159
183
  } else {
160
184
  body = rawBody;
161
185
  }
162
- } else {
163
- body = rawBody;
164
186
  }
165
- } else {
166
- body = rawBody;
167
187
  }
168
188
  }
169
189
  await nitro.hooks.callHook("nuxt-scripts:proxy", {
@@ -172,29 +192,38 @@ export default defineEventHandler(async (event) => {
172
192
  targetUrl,
173
193
  method: method || "GET",
174
194
  privacy,
195
+ passthroughBody,
175
196
  original: {
176
197
  headers: { ...originalHeaders },
177
198
  query: originalQuery,
178
- body: rawBody ?? null
199
+ body: passthroughBody ? "<passthrough>" : rawBody ?? null
179
200
  },
180
201
  stripped: {
181
202
  headers,
182
203
  query: anyPrivacy ? stripPayloadFingerprinting(originalQuery, privacy) : originalQuery,
183
- body: body ?? null
204
+ body: passthroughBody ? "<passthrough>" : body ?? null
184
205
  }
185
206
  });
186
207
  log("[proxy] Fetching:", targetUrl);
187
208
  const controller = new AbortController();
188
209
  const timeoutId = setTimeout(() => controller.abort(), 15e3);
210
+ let fetchBody;
211
+ if (passthroughBody) {
212
+ fetchBody = getRequestWebStream(event);
213
+ } else if (body !== void 0) {
214
+ fetchBody = typeof body === "string" ? body : JSON.stringify(body);
215
+ }
189
216
  let response;
190
217
  try {
191
218
  response = await fetch(targetUrl, {
192
219
  method: method || "GET",
193
220
  headers,
194
- body: body ? typeof body === "string" ? body : JSON.stringify(body) : void 0,
221
+ body: fetchBody,
195
222
  credentials: "omit",
196
223
  // Don't send cookies to third parties
197
- signal: controller.signal
224
+ signal: controller.signal,
225
+ // @ts-expect-error Node fetch supports duplex for streaming request bodies
226
+ duplex: passthroughBody ? "half" : void 0
198
227
  });
199
228
  } catch (err) {
200
229
  clearTimeout(timeoutId);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/scripts",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.6",
4
+ "version": "1.0.0-beta.7",
5
5
  "description": "Load third-party scripts with better performance, privacy and DX in Nuxt Apps.",
6
6
  "author": {
7
7
  "website": "https://harlanzw.com",
@@ -96,7 +96,7 @@
96
96
  "magic-string": "^0.30.21",
97
97
  "ofetch": "^1.5.1",
98
98
  "ohash": "^2.0.11",
99
- "oxc-parser": "^0.115.0",
99
+ "oxc-parser": "^0.116.0",
100
100
  "oxc-walker": "^0.7.0",
101
101
  "pathe": "^2.0.3",
102
102
  "pkg-types": "^2.3.0",
@@ -113,7 +113,7 @@
113
113
  "@nuxt/module-builder": "^1.0.2",
114
114
  "@nuxt/test-utils": "^4.0.0",
115
115
  "@nuxtjs/partytown": "^2.0.0",
116
- "@paypal/paypal-js": "^9.3.0",
116
+ "@paypal/paypal-js": "^9.4.0",
117
117
  "@types/semver": "^7.7.1",
118
118
  "@typescript-eslint/typescript-estree": "^8.56.1",
119
119
  "@vue/test-utils": "^2.4.6",
@@ -121,18 +121,18 @@
121
121
  "changelogen": "^0.6.2",
122
122
  "eslint": "^10.0.2",
123
123
  "eslint-plugin-n": "^17.24.0",
124
- "happy-dom": "^20.7.0",
124
+ "happy-dom": "^20.8.3",
125
125
  "knitwork": "^1.3.0",
126
126
  "nuxt": "^4.3.1",
127
127
  "playwright-core": "^1.58.2",
128
- "posthog-js": "^1.356.1",
129
- "shiki": "^4.0.0",
128
+ "posthog-js": "^1.357.1",
129
+ "shiki": "^4.0.1",
130
130
  "typescript": "5.9.3",
131
131
  "vitest": "^4.0.18",
132
132
  "vue": "^3.5.29",
133
133
  "vue-router": "^5.0.3",
134
134
  "vue-tsc": "^3.2.5",
135
- "@nuxt/scripts": "1.0.0-beta.6"
135
+ "@nuxt/scripts": "1.0.0-beta.7"
136
136
  },
137
137
  "resolutions": {
138
138
  "@nuxt/scripts": "workspace:*"
@@ -1 +0,0 @@
1
- {"id":"762d443a-0880-424f-bda8-2b32b39d43ec","timestamp":1772420315053,"prerendered":[]}