@nuxt/scripts 1.0.0-beta.5 → 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":"d7be6a88-31d8-4c91-90c7-54ab7d487a0f","timestamp":1772073969311}
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"./BjwaReHq.js";import{u as i}from"./BdlC6_ZE.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/BjwaReHq.js"><script type="module" src="/__nuxt-scripts/_nuxt/BjwaReHq.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:""},"nuxt-scripts-sw":{path:"/_nuxt-scripts-sw.js"}},app:{baseURL:"/__nuxt-scripts",buildId:"d7be6a88-31d8-4c91-90c7-54ab7d487a0f",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1772073973764,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.5",
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
@@ -1,5 +1,6 @@
1
- import { useNuxt, extendViteConfig, useLogger, addDevServerHandler, extendRouteRules, tryUseNuxt, logger as logger$1, addTypeTemplate, defineNuxtModule, createResolver, hasNuxtModule, addImports, addComponentsDir, addTemplate, addServerHandler, addPluginTemplate, addBuildPlugin } from '@nuxt/kit';
2
- import { existsSync, readFileSync } from 'node:fs';
1
+ import { useNuxt, extendViteConfig, useLogger, addDevServerHandler, extendRouteRules, tryUseNuxt, logger as logger$1, addTypeTemplate, defineNuxtModule, createResolver, hasNuxtModule, addImports, addComponentsDir, addTemplate, addPluginTemplate, addServerHandler, addBuildPlugin } from '@nuxt/kit';
2
+ import { existsSync, readdirSync, readFileSync } from 'node:fs';
3
+ import { join, resolve, relative } from 'pathe';
3
4
  import { defu } from 'defu';
4
5
  import { resolvePackageJSON, readPackageJSON } from 'pkg-types';
5
6
  import { addCustomTab } from '@nuxt/devtools-kit';
@@ -10,13 +11,11 @@ import MagicString from 'magic-string';
10
11
  import { parseAndWalk } from 'oxc-walker';
11
12
  import { joinURL, parseURL, parseQuery, hasProtocol } from 'ufo';
12
13
  import { hash } from 'ohash';
13
- import { join, resolve, relative } from 'pathe';
14
14
  import { colors } from 'consola/utils';
15
15
  import { fetch, $fetch } from 'ofetch';
16
16
  import { lazyEventHandler, eventHandler, createError } from 'h3';
17
17
  import { createStorage } from 'unstorage';
18
18
  import fsDriver from 'unstorage/drivers/fs-lite';
19
- import { rewriteScriptUrls } from '../dist/runtime/utils/pure.js';
20
19
  import { pathToFileURL } from 'node:url';
21
20
  import { isCI, provider } from 'std-env';
22
21
  import { registry } from './registry.mjs';
@@ -235,10 +234,12 @@ function buildProxyConfig(collectPrefix) {
235
234
  // Reddit: untrusted ad network — full anonymization
236
235
  privacy: { ip: true, userAgent: true, language: true, screen: true, timezone: true, hardware: true },
237
236
  rewrite: [
238
- { 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` }
239
239
  ],
240
240
  routes: {
241
- [`${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/**" }
242
243
  }
243
244
  },
244
245
  clarity: {
@@ -302,6 +303,88 @@ function buildProxyConfig(collectPrefix) {
302
303
  [`${collectPrefix}/hotjar-metrics/**`]: { proxy: "https://metrics.hotjar.io/**" },
303
304
  [`${collectPrefix}/hotjar-insights/**`]: { proxy: "https://insights.hotjar.com/**" }
304
305
  }
306
+ },
307
+ plausible: {
308
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
309
+ rewrite: [
310
+ { from: "plausible.io", to: `${collectPrefix}/plausible` }
311
+ ],
312
+ routes: {
313
+ [`${collectPrefix}/plausible/**`]: { proxy: "https://plausible.io/**" }
314
+ }
315
+ },
316
+ cloudflareWebAnalytics: {
317
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
318
+ rewrite: [
319
+ { from: "static.cloudflareinsights.com", to: `${collectPrefix}/cfwa` },
320
+ { from: "cloudflareinsights.com", to: `${collectPrefix}/cfwa-beacon` }
321
+ ],
322
+ routes: {
323
+ [`${collectPrefix}/cfwa/**`]: { proxy: "https://static.cloudflareinsights.com/**" },
324
+ [`${collectPrefix}/cfwa-beacon/**`]: { proxy: "https://cloudflareinsights.com/**" }
325
+ }
326
+ },
327
+ rybbit: {
328
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
329
+ rewrite: [
330
+ { from: "app.rybbit.io", to: `${collectPrefix}/rybbit` }
331
+ ],
332
+ routes: {
333
+ [`${collectPrefix}/rybbit/**`]: { proxy: "https://app.rybbit.io/**" }
334
+ }
335
+ },
336
+ umami: {
337
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
338
+ rewrite: [
339
+ { from: "cloud.umami.is", to: `${collectPrefix}/umami` }
340
+ ],
341
+ routes: {
342
+ [`${collectPrefix}/umami/**`]: { proxy: "https://cloud.umami.is/**" }
343
+ }
344
+ },
345
+ databuddy: {
346
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
347
+ rewrite: [
348
+ { from: "cdn.databuddy.cc", to: `${collectPrefix}/databuddy` },
349
+ { from: "basket.databuddy.cc", to: `${collectPrefix}/databuddy-api` }
350
+ ],
351
+ routes: {
352
+ [`${collectPrefix}/databuddy/**`]: { proxy: "https://cdn.databuddy.cc/**" },
353
+ [`${collectPrefix}/databuddy-api/**`]: { proxy: "https://basket.databuddy.cc/**" }
354
+ }
355
+ },
356
+ fathom: {
357
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
358
+ rewrite: [
359
+ { from: "cdn.usefathom.com", to: `${collectPrefix}/fathom` }
360
+ ],
361
+ routes: {
362
+ [`${collectPrefix}/fathom/**`]: { proxy: "https://cdn.usefathom.com/**" }
363
+ }
364
+ },
365
+ intercom: {
366
+ privacy: { ip: true, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
367
+ rewrite: [
368
+ { from: "widget.intercom.io", to: `${collectPrefix}/intercom` },
369
+ { from: "api-iam.intercom.io", to: `${collectPrefix}/intercom-api` },
370
+ { from: "api-iam.eu.intercom.io", to: `${collectPrefix}/intercom-api-eu` },
371
+ { from: "api-iam.au.intercom.io", to: `${collectPrefix}/intercom-api-au` }
372
+ ],
373
+ routes: {
374
+ [`${collectPrefix}/intercom/**`]: { proxy: "https://widget.intercom.io/**" },
375
+ [`${collectPrefix}/intercom-api/**`]: { proxy: "https://api-iam.intercom.io/**" },
376
+ [`${collectPrefix}/intercom-api-eu/**`]: { proxy: "https://api-iam.eu.intercom.io/**" },
377
+ [`${collectPrefix}/intercom-api-au/**`]: { proxy: "https://api-iam.au.intercom.io/**" }
378
+ }
379
+ },
380
+ crisp: {
381
+ privacy: { ip: true, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
382
+ rewrite: [
383
+ { from: "client.crisp.chat", to: `${collectPrefix}/crisp` }
384
+ ],
385
+ routes: {
386
+ [`${collectPrefix}/crisp/**`]: { proxy: "https://client.crisp.chat/**" }
387
+ }
305
388
  }
306
389
  };
307
390
  }
@@ -312,20 +395,15 @@ function getProxyConfig(key, collectPrefix) {
312
395
  function getAllProxyConfigs(collectPrefix) {
313
396
  return buildProxyConfig(collectPrefix);
314
397
  }
315
- function getSWInterceptRules(collectPrefix) {
316
- const configs = buildProxyConfig(collectPrefix);
398
+ function routesToInterceptRules(routes) {
317
399
  const rules = [];
318
- for (const config of Object.values(configs)) {
319
- if (!config.routes)
320
- continue;
321
- for (const [localPath, { proxy }] of Object.entries(config.routes)) {
322
- const match = proxy.match(/^https?:\/\/([^/]+)(\/.*)?\/\*\*$/);
323
- if (match?.[1]) {
324
- const domain = match[1];
325
- const pathPrefix = match[2] || "";
326
- const target = localPath.replace(/\/\*\*$/, "");
327
- rules.push({ pattern: domain, pathPrefix, target });
328
- }
400
+ for (const [localPath, { proxy }] of Object.entries(routes)) {
401
+ const match = proxy.match(/^https?:\/\/([^/]+)(\/.*)?\/\*\*$/);
402
+ if (match?.[1]) {
403
+ const domain = match[1];
404
+ const pathPrefix = match[2] || "";
405
+ const target = localPath.replace(/\/\*\*$/, "");
406
+ rules.push({ pattern: domain, pathPrefix, target });
329
407
  }
330
408
  }
331
409
  return rules;
@@ -358,6 +436,114 @@ function isJS(id) {
358
436
  return JS_RE.test(pathname);
359
437
  }
360
438
 
439
+ function isPropertyKeyAST(parent, ctx) {
440
+ return parent?.type === "Property" && ctx.key === "key" || parent?.type === "SwitchCase" && ctx.key === "test";
441
+ }
442
+ function matchAndRewrite(value, rewrites) {
443
+ for (const { from, to } of rewrites) {
444
+ const isSuffixMatch = from.startsWith(".");
445
+ const fromSlashIdx = from.indexOf("/");
446
+ const fromHost = fromSlashIdx > 0 ? from.slice(0, fromSlashIdx) : from;
447
+ const fromPath = fromSlashIdx > 0 ? from.slice(fromSlashIdx) : "";
448
+ if (!value.includes(fromHost)) continue;
449
+ const url = parseURL(value);
450
+ let shouldRewrite = false;
451
+ let rewriteSuffix = "";
452
+ if (url.host) {
453
+ const hostMatches = isSuffixMatch ? url.host.endsWith(fromHost) : url.host === fromHost;
454
+ if (hostMatches) {
455
+ const fullPath = url.pathname + (url.search || "") + (url.hash || "");
456
+ if (fromPath && fullPath.startsWith(fromPath)) {
457
+ shouldRewrite = true;
458
+ rewriteSuffix = fullPath.slice(fromPath.length);
459
+ } else if (!fromPath) {
460
+ shouldRewrite = true;
461
+ rewriteSuffix = fullPath;
462
+ }
463
+ }
464
+ } else if (value.startsWith("//")) {
465
+ const hostPart = value.slice(2).split("/")[0];
466
+ const hostMatches = isSuffixMatch ? hostPart?.endsWith(fromHost) ?? false : hostPart === fromHost;
467
+ if (hostMatches) {
468
+ const remainder = value.slice(2 + (hostPart?.length ?? 0));
469
+ if (fromPath && remainder.startsWith(fromPath)) {
470
+ shouldRewrite = true;
471
+ rewriteSuffix = remainder.slice(fromPath.length);
472
+ } else if (!fromPath) {
473
+ shouldRewrite = true;
474
+ rewriteSuffix = remainder;
475
+ }
476
+ }
477
+ } else if (fromPath && (value.startsWith(from) || isSuffixMatch && value.includes(from))) {
478
+ const domainEnd = value.indexOf(from) + from.length;
479
+ const nextChar = value[domainEnd];
480
+ if (!nextChar || nextChar === "/" || nextChar === "?" || nextChar === "#") {
481
+ shouldRewrite = true;
482
+ rewriteSuffix = value.slice(domainEnd);
483
+ }
484
+ }
485
+ if (shouldRewrite) {
486
+ return rewriteSuffix === "/" || rewriteSuffix.startsWith("?") || rewriteSuffix.startsWith("#") ? to + rewriteSuffix : joinURL(to, rewriteSuffix);
487
+ }
488
+ }
489
+ return null;
490
+ }
491
+ function rewriteScriptUrlsAST(content, filename, rewrites) {
492
+ const s = new MagicString(content);
493
+ parseAndWalk(content, filename, function(node, parent, ctx) {
494
+ if (node.type === "Literal" && typeof node.value === "string") {
495
+ const value = node.value;
496
+ const rewritten = matchAndRewrite(value, rewrites);
497
+ if (rewritten === null) return;
498
+ const quote = content[node.start];
499
+ if (isPropertyKeyAST(parent, ctx)) {
500
+ s.overwrite(node.start, node.end, quote + rewritten + quote);
501
+ } else {
502
+ s.overwrite(node.start, node.end, "self.location.origin+" + quote + rewritten + quote);
503
+ }
504
+ }
505
+ if (node.type === "TemplateLiteral" && node.expressions?.length === 0) {
506
+ const quasis = node.quasis;
507
+ if (quasis?.length === 1) {
508
+ const value = quasis[0].value?.cooked ?? quasis[0].value?.raw;
509
+ if (typeof value !== "string") return;
510
+ const rewritten = matchAndRewrite(value, rewrites);
511
+ if (rewritten === null) return;
512
+ if (isPropertyKeyAST(parent, ctx)) {
513
+ s.overwrite(node.start, node.end, "`" + rewritten + "`");
514
+ } else {
515
+ s.overwrite(node.start, node.end, "self.location.origin+`" + rewritten + "`");
516
+ }
517
+ }
518
+ }
519
+ if (node.type === "CallExpression") {
520
+ const callee = node.callee;
521
+ if (callee?.type === "MemberExpression" && !callee.computed && callee.object?.type === "Identifier" && callee.object.name === "navigator" && callee.property?.name === "sendBeacon") {
522
+ s.overwrite(callee.start, callee.end, "__nuxtScripts.sendBeacon");
523
+ }
524
+ if (callee?.type === "Identifier" && callee.name === "fetch") {
525
+ s.overwrite(callee.start, callee.end, "__nuxtScripts.fetch");
526
+ }
527
+ if (callee?.type === "MemberExpression" && !callee.computed && callee.object?.type === "Identifier" && (callee.object.name === "window" || callee.object.name === "self" || callee.object.name === "globalThis") && callee.property?.name === "fetch") {
528
+ s.overwrite(callee.start, callee.end, "__nuxtScripts.fetch");
529
+ }
530
+ }
531
+ });
532
+ let output = s.toString();
533
+ const gaRewrite = rewrites.find((r) => r.from.includes("google-analytics.com/g/collect"));
534
+ if (gaRewrite) {
535
+ output = output.replace(
536
+ /"https:\/\/"\+\(.*?\)\+"\.google-analytics\.com\/g\/collect"/g,
537
+ `self.location.origin+"${gaRewrite.to}"`
538
+ );
539
+ output = output.replace(
540
+ /"https:\/\/"\+\(.*?\)\+"\.analytics\.google\.com\/g\/collect"/g,
541
+ `self.location.origin+"${gaRewrite.to}"`
542
+ );
543
+ }
544
+ return output;
545
+ }
546
+
361
547
  const SEVEN_DAYS_IN_MS = 7 * 24 * 60 * 60 * 1e3;
362
548
  function calculateIntegrity(content, algorithm = "sha384") {
363
549
  const hash = createHash(algorithm).update(content).digest("base64");
@@ -375,10 +561,8 @@ function normalizeScriptData(src, assetsBaseURL = "/_scripts") {
375
561
  if (hasProtocol(src, { acceptRelative: true })) {
376
562
  src = src.replace(/^\/\//, "https://");
377
563
  const url = parseURL(src);
378
- const file = [
379
- `${hash(url)}.js`
380
- // force an extension
381
- ].filter(Boolean).join("-");
564
+ const h = hash(url);
565
+ const file = `${h.startsWith("-") ? `_${h.slice(1)}` : h}.js`;
382
566
  const nuxt = tryUseNuxt();
383
567
  const cdnURL = nuxt?.options.runtimeConfig?.app?.cdnURL || nuxt?.options.app?.cdnURL || "";
384
568
  const baseURL = cdnURL || nuxt?.options.app.baseURL || "";
@@ -425,7 +609,7 @@ async function downloadScript(opts, renderedScript, fetchOptions, cacheMaxAge) {
425
609
  await storage.setItemRaw(`bundle:${filename}`, res);
426
610
  if (proxyRewrites?.length && res) {
427
611
  const content = res.toString("utf-8");
428
- const rewritten = rewriteScriptUrls(content, proxyRewrites);
612
+ const rewritten = rewriteScriptUrlsAST(content, filename || "script.js", proxyRewrites);
429
613
  res = Buffer.from(rewritten, "utf-8");
430
614
  logger.debug(`Rewrote ${proxyRewrites.length} URL patterns in ${filename}`);
431
615
  }
@@ -896,7 +1080,7 @@ function templatePlugin(config, registry) {
896
1080
  let needsInteractionImport = false;
897
1081
  let needsServiceWorkerImport = false;
898
1082
  for (const [k, c] of Object.entries(config.registry || {})) {
899
- const importDefinition = registry.find((i) => i.proxy === k || i.import.name === `useScript${k.substring(0, 1).toUpperCase() + k.substring(1)}`);
1083
+ const importDefinition = registry.find((i) => i.import.name.toLowerCase() === `usescript${k.toLowerCase()}`);
900
1084
  if (importDefinition) {
901
1085
  resolvedRegistryKeys.push(k);
902
1086
  imports.unshift(`import { ${importDefinition.import.name} } from '${importDefinition.import.from}'`);
@@ -979,6 +1163,51 @@ function templatePlugin(config, registry) {
979
1163
  ].join("\n");
980
1164
  }
981
1165
 
1166
+ const SELF_CLOSING_SCRIPT_RE = /<((?:Script[A-Z]|script-)\w[\w-]*)\b([^>]*?)\/\s*>/g;
1167
+ function fixSelfClosingScriptComponents(nuxt) {
1168
+ function expandTags(content) {
1169
+ SELF_CLOSING_SCRIPT_RE.lastIndex = 0;
1170
+ if (!SELF_CLOSING_SCRIPT_RE.test(content)) return null;
1171
+ SELF_CLOSING_SCRIPT_RE.lastIndex = 0;
1172
+ return content.replace(SELF_CLOSING_SCRIPT_RE, (_, tag, attrs) => `<${tag}${attrs.trimEnd()}></${tag}>`);
1173
+ }
1174
+ function fixFile(filePath) {
1175
+ if (!existsSync(filePath)) return;
1176
+ const content = readFileSync(filePath, "utf-8");
1177
+ const fixed = expandTags(content);
1178
+ if (fixed) nuxt.vfs[filePath] = fixed;
1179
+ }
1180
+ function scanDir(dir) {
1181
+ if (!existsSync(dir)) return;
1182
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
1183
+ const fullPath = resolve(dir, entry.name);
1184
+ if (entry.isDirectory()) scanDir(fullPath);
1185
+ else if (entry.name.endsWith(".vue")) fixFile(fullPath);
1186
+ }
1187
+ }
1188
+ const pagesDirs = /* @__PURE__ */ new Set();
1189
+ for (const layer of nuxt.options._layers) {
1190
+ pagesDirs.add(resolve(
1191
+ layer.config.srcDir,
1192
+ layer.config.dir?.pages || "pages"
1193
+ ));
1194
+ }
1195
+ for (const dir of pagesDirs) scanDir(dir);
1196
+ if (nuxt.options.dev) {
1197
+ nuxt.hook("builder:watch", (_event, relativePath) => {
1198
+ if (!relativePath.endsWith(".vue")) return;
1199
+ for (const layer of nuxt.options._layers) {
1200
+ const fullPath = resolve(layer.config.srcDir, relativePath);
1201
+ for (const dir of pagesDirs) {
1202
+ if (fullPath.startsWith(`${dir}/`)) {
1203
+ fixFile(fullPath);
1204
+ return;
1205
+ }
1206
+ }
1207
+ }
1208
+ });
1209
+ }
1210
+ }
982
1211
  const PARTYTOWN_FORWARDS = {
983
1212
  googleAnalytics: ["dataLayer.push", "gtag"],
984
1213
  plausible: ["plausible"],
@@ -1042,8 +1271,7 @@ const module$1 = defineNuxtModule({
1042
1271
  nuxt.options.runtimeConfig["nuxt-scripts"] = {
1043
1272
  version,
1044
1273
  // Private proxy config with API key (server-side only)
1045
- googleStaticMapsProxy: config.googleStaticMapsProxy?.enabled ? { apiKey: nuxt.options.runtimeConfig.public.scripts?.googleMaps?.apiKey } : void 0,
1046
- swTemplate: readFileSync(await resolvePath("./runtime/sw/proxy-sw.template.js"), "utf-8")
1274
+ googleStaticMapsProxy: config.googleStaticMapsProxy?.enabled ? { apiKey: nuxt.options.runtimeConfig.public.scripts?.googleMaps?.apiKey } : void 0
1047
1275
  };
1048
1276
  nuxt.options.runtimeConfig.public["nuxt-scripts"] = {
1049
1277
  // expose for devtools
@@ -1123,103 +1351,53 @@ const module$1 = defineNuxtModule({
1123
1351
  path: await resolvePath("./runtime/components"),
1124
1352
  pathPrefix: false
1125
1353
  });
1354
+ fixSelfClosingScriptComponents(nuxt);
1126
1355
  addTemplate({
1127
1356
  filename: "nuxt-scripts-trigger-resolver.mjs",
1128
1357
  getContents() {
1129
1358
  return templateTriggerResolver(config.defaultScriptOptions);
1130
1359
  }
1131
1360
  });
1132
- const swHandlerPath = await resolvePath("./runtime/server/sw-handler");
1133
1361
  logger.debug("[nuxt-scripts] First-party config:", { firstPartyEnabled, firstPartyPrivacy, firstPartyCollectPrefix });
1134
- if (firstPartyEnabled && !nuxt.options.dev) {
1135
- const swPath = "/_nuxt-scripts-sw.js";
1136
- const swRules = getSWInterceptRules(firstPartyCollectPrefix);
1137
- addServerHandler({
1138
- route: swPath,
1139
- handler: swHandlerPath
1140
- });
1141
- addPluginTemplate({
1142
- filename: "nuxt-scripts-sw-register.client.mjs",
1143
- getContents() {
1144
- return `import { defineNuxtPlugin } from 'nuxt/app'
1145
-
1146
- export default defineNuxtPlugin({
1147
- name: 'nuxt-scripts:sw-register',
1148
- enforce: 'pre',
1149
- async setup() {
1150
- if (!('serviceWorker' in navigator)) return;
1151
-
1152
- try {
1153
- const reg = await navigator.serviceWorker.register('${swPath}', { scope: '/' });
1154
-
1155
- // Wait for SW to be active and controlling this page
1156
- if (!navigator.serviceWorker.controller) {
1157
- await new Promise((resolve) => {
1158
- const onControllerChange = () => {
1159
- navigator.serviceWorker.removeEventListener('controllerchange', onControllerChange);
1160
- resolve();
1161
- };
1162
- navigator.serviceWorker.addEventListener('controllerchange', onControllerChange);
1163
-
1164
- // Fallback timeout
1165
- setTimeout(resolve, 2000);
1166
- });
1167
- }
1168
- } catch (err) {
1169
- console.warn('[nuxt-scripts] SW registration failed:', err);
1170
- }
1171
- },
1172
- })
1173
- `;
1174
- }
1175
- });
1362
+ let interceptRules = [];
1363
+ if (firstPartyEnabled) {
1176
1364
  addPluginTemplate({
1177
- filename: "nuxt-scripts-beacon-intercept.client.mjs",
1365
+ filename: "nuxt-scripts-intercept.client.mjs",
1178
1366
  getContents() {
1179
- const rulesJson = JSON.stringify(swRules);
1367
+ const rulesJson = JSON.stringify(interceptRules);
1180
1368
  return `export default defineNuxtPlugin({
1181
- name: 'nuxt-scripts:beacon-intercept',
1369
+ name: 'nuxt-scripts:intercept',
1182
1370
  enforce: 'pre',
1183
1371
  setup() {
1184
- if (typeof navigator === 'undefined' || !navigator.sendBeacon) return;
1185
-
1186
1372
  const rules = ${rulesJson};
1187
- const originalBeacon = navigator.sendBeacon.bind(navigator);
1373
+ const origBeacon = typeof navigator !== 'undefined' && navigator.sendBeacon
1374
+ ? navigator.sendBeacon.bind(navigator)
1375
+ : () => false;
1376
+ const origFetch = globalThis.fetch.bind(globalThis);
1188
1377
 
1189
- navigator.sendBeacon = (url, data) => {
1378
+ function rewriteUrl(url) {
1190
1379
  try {
1191
- const parsed = new URL(url, window.location.origin);
1192
-
1193
- // Check if this URL matches any of our proxy rules
1380
+ const parsed = new URL(url, location.origin);
1194
1381
  for (const rule of rules) {
1195
1382
  if (parsed.hostname === rule.pattern || parsed.hostname.endsWith('.' + rule.pattern)) {
1196
- // Check path prefix if specified
1197
- if (rule.pathPrefix && !parsed.pathname.startsWith(rule.pathPrefix)) {
1198
- continue;
1199
- }
1200
-
1201
- // Rewrite to proxy: strip pathPrefix from original, prepend target
1202
- const pathWithoutPrefix = rule.pathPrefix
1203
- ? parsed.pathname.slice(rule.pathPrefix.length)
1204
- : parsed.pathname;
1205
- const separator = pathWithoutPrefix.startsWith('/') ? '' : '/';
1206
- const proxyUrl = window.location.origin + rule.target + separator + pathWithoutPrefix + parsed.search;
1207
-
1208
- return originalBeacon(proxyUrl, data);
1383
+ if (rule.pathPrefix && !parsed.pathname.startsWith(rule.pathPrefix)) continue;
1384
+ const path = rule.pathPrefix ? parsed.pathname.slice(rule.pathPrefix.length) : parsed.pathname;
1385
+ return location.origin + rule.target + (path.startsWith('/') ? '' : '/') + path + parsed.search;
1209
1386
  }
1210
1387
  }
1211
- } catch (e) {
1212
- // URL parsing failed, pass through
1213
- }
1388
+ } catch {}
1389
+ return url;
1390
+ }
1214
1391
 
1215
- return originalBeacon(url, data);
1392
+ globalThis.__nuxtScripts = {
1393
+ sendBeacon: (url, data) => origBeacon(rewriteUrl(url), data),
1394
+ fetch: (url, opts) => origFetch(typeof url === 'string' ? rewriteUrl(url) : url, opts),
1216
1395
  };
1217
1396
  },
1218
1397
  })
1219
1398
  `;
1220
1399
  }
1221
1400
  });
1222
- nuxt.options.runtimeConfig.public["nuxt-scripts-sw"] = { path: swPath };
1223
1401
  const proxyHandlerPath = await resolvePath("./runtime/server/proxy-handler");
1224
1402
  logger.debug("[nuxt-scripts] Registering proxy handler:", `${firstPartyCollectPrefix}/**`, "->", proxyHandlerPath);
1225
1403
  addServerHandler({
@@ -1288,28 +1466,17 @@ export default defineNuxtPlugin({
1288
1466
  They will load directly from third-party servers. Request support at https://github.com/nuxt/scripts/issues`
1289
1467
  );
1290
1468
  }
1469
+ interceptRules = routesToInterceptRules(neededRoutes);
1291
1470
  const flatRoutes = {};
1292
1471
  for (const [path, config2] of Object.entries(neededRoutes)) {
1293
1472
  flatRoutes[path] = config2.proxy;
1294
1473
  }
1295
- const allRewrites = [];
1296
- for (const key of registryKeys) {
1297
- const script = registryScriptsWithImport.find((s) => s.import.name.toLowerCase() === `usescript${key.toLowerCase()}`);
1298
- const proxyKey = script?.proxy !== false ? script?.proxy || key : void 0;
1299
- if (proxyKey) {
1300
- const proxyConfig = proxyConfigs[proxyKey];
1301
- if (proxyConfig?.rewrite) {
1302
- allRewrites.push(...proxyConfig.rewrite);
1303
- }
1304
- }
1305
- }
1306
1474
  nuxt.options.runtimeConfig["nuxt-scripts-proxy"] = {
1307
1475
  routes: flatRoutes,
1308
1476
  privacy: firstPartyPrivacy,
1309
1477
  // undefined = use per-script defaults, set = global override
1310
- routePrivacy: routePrivacyOverrides,
1478
+ routePrivacy: routePrivacyOverrides
1311
1479
  // per-script privacy from registry
1312
- rewrites: allRewrites
1313
1480
  };
1314
1481
  if (Object.keys(neededRoutes).length) {
1315
1482
  if (nuxt.options.dev) {
package/dist/registry.mjs CHANGED
@@ -5,6 +5,7 @@ async function registry(resolve) {
5
5
  return [
6
6
  {
7
7
  label: "Plausible Analytics",
8
+ proxy: "plausible",
8
9
  category: "analytics",
9
10
  scriptBundling: (options) => {
10
11
  const extensions = Array.isArray(options?.extension) ? options.extension.join(".") : [options?.extension];
@@ -18,6 +19,7 @@ async function registry(resolve) {
18
19
  },
19
20
  {
20
21
  label: "Cloudflare Web Analytics",
22
+ proxy: "cloudflareWebAnalytics",
21
23
  src: "https://static.cloudflareinsights.com/beacon.min.js",
22
24
  category: "analytics",
23
25
  logo: `<svg xmlns="http://www.w3.org/2000/svg" width="70.02" height="32" viewBox="0 0 256 117"><path fill="#FBAD41" d="M205.52 50.813c-.858 0-1.705.03-2.551.058c-.137.007-.272.04-.398.094a1.424 1.424 0 0 0-.92.994l-3.628 12.672c-1.565 5.449-.983 10.48 1.646 14.174c2.41 3.416 6.42 5.421 11.289 5.655l19.679 1.194c.585.03 1.092.312 1.4.776a1.92 1.92 0 0 1 .2 1.692a2.496 2.496 0 0 1-2.134 1.662l-20.448 1.193c-11.11.515-23.062 9.58-27.255 20.633l-1.474 3.9a1.092 1.092 0 0 0 .967 1.49h70.425a1.872 1.872 0 0 0 1.81-1.365A51.172 51.172 0 0 0 256 101.828c0-28.16-22.582-50.984-50.449-50.984"/><path fill="#F6821F" d="m174.782 115.362l1.303-4.583c1.568-5.449.987-10.48-1.639-14.173c-2.418-3.417-6.424-5.422-11.296-5.656l-92.312-1.193a1.822 1.822 0 0 1-1.459-.776a1.919 1.919 0 0 1-.203-1.693a2.496 2.496 0 0 1 2.154-1.662l93.173-1.193c11.063-.511 23.015-9.58 27.208-20.633l5.313-14.04c.214-.596.27-1.238.156-1.86C191.126 20.51 166.91 0 137.96 0C111.269 0 88.626 17.403 80.5 41.596a26.996 26.996 0 0 0-19.156-5.359C48.549 37.524 38.25 47.946 36.979 60.88a27.905 27.905 0 0 0 .702 9.642C16.773 71.145 0 88.454 0 109.726c0 1.923.137 3.818.413 5.667c.115.897.879 1.57 1.783 1.568h170.48a2.223 2.223 0 0 0 2.106-1.63"/></svg>`,
@@ -40,6 +42,7 @@ async function registry(resolve) {
40
42
  },
41
43
  {
42
44
  label: "Fathom Analytics",
45
+ proxy: "fathom",
43
46
  scriptBundling: false,
44
47
  // breaks script
45
48
  category: "analytics",
@@ -62,8 +65,12 @@ async function registry(resolve) {
62
65
  },
63
66
  {
64
67
  label: "Rybbit Analytics",
68
+ proxy: "rybbit",
65
69
  category: "analytics",
66
- 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
+ },
67
74
  import: {
68
75
  name: "useScriptRybbitAnalytics",
69
76
  from: await resolve("./runtime/registry/rybbit-analytics")
@@ -71,6 +78,7 @@ async function registry(resolve) {
71
78
  },
72
79
  {
73
80
  label: "Databuddy Analytics",
81
+ proxy: "databuddy",
74
82
  category: "analytics",
75
83
  logo: `<svg xmlns="http://www.w3.org/2000/svg" width="56.5" height="32" viewBox="0 0 8 8" shape-rendering="crispEdges"><path d="M0 0h8v8H0z"/><path fill="#fff" d="M1 1h1v6H1zm1 0h4v1H2zm4 1h1v1H6zm0 1h1v1H6zm0 1h1v1H6zm0 1h1v1H6zM2 6h4v1H2zm1-3h1v1H3zm1 1h1v1H4z"/></svg>`,
76
84
  import: {
@@ -156,6 +164,7 @@ async function registry(resolve) {
156
164
  // ads
157
165
  {
158
166
  label: "Google Adsense",
167
+ proxy: "googleAnalytics",
159
168
  scriptBundling: (options) => {
160
169
  if (!options?.client) {
161
170
  return false;
@@ -180,6 +189,7 @@ async function registry(resolve) {
180
189
  // marketing
181
190
  {
182
191
  label: "Intercom",
192
+ proxy: "intercom",
183
193
  scriptBundling(options) {
184
194
  if (!options?.app_id) {
185
195
  return false;
@@ -291,6 +301,7 @@ async function registry(resolve) {
291
301
  // chat
292
302
  {
293
303
  label: "Crisp",
304
+ proxy: "crisp",
294
305
  category: "support",
295
306
  logo: {
296
307
  light: `<svg height="30" width="35" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><filter id="a" height="138.7%" width="131.4%" x="-15.7%" y="-15.1%"><feMorphology in="SourceAlpha" operator="dilate" radius="1" result="shadowSpreadOuter1"/><feOffset dy="1" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/><feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation="1"/><feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"/><feColorMatrix in="shadowBlurOuter1" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.07 0"/></filter><path id="b" d="M14.23 20.46l-9.65 1.1L3 5.12 30.07 2l1.58 16.46-9.37 1.07-3.5 5.72-4.55-4.8z"/></defs><g fill="none" fill-rule="evenodd"><use fill="#000" filter="url(#a)" xlink:href="#b"/><use fill="#1972f5" stroke="#1972f5" stroke-width="2" xlink:href="#b"/></g></svg>`,
@@ -388,6 +399,7 @@ async function registry(resolve) {
388
399
  },
389
400
  {
390
401
  label: "Umami Analytics",
402
+ proxy: "umami",
391
403
  category: "analytics",
392
404
  logo: `<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24"><path fill="currentColor" d="M2.203 8.611H.857a.845.845 0 0 0-.841.841v.858a13 13 0 0 0-.016.6c0 6.627 5.373 12 12 12c6.527 0 11.837-5.212 11.996-11.701c0-.025.004-.05.004-.075V9.452a.845.845 0 0 0-.841-.841h-1.346c-1.159-4.329-5.112-7.521-9.805-7.521S3.363 4.282 2.203 8.611m18.444 0H3.37c1.127-3.702 4.57-6.399 8.638-6.399c4.069 0 7.512 2.697 8.639 6.399"/></svg>`,
393
405
  import: {
@@ -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>;