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

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
- import{_ as s,c as a,o as i,a as t,t as n,b as u,w as c,d as l,e as d}from"./D-kOnTuH.js";import{u as f}from"./Ds2G8aQM.js";const p={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"},m={class:"max-w-520px text-center"},h=["textContent"],b=["textContent"],x=["textContent"],g={class:"flex items-center justify-center w-full"},y={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},status:{type:Number,default:404},statusText:{type:String,default:"Page not found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(e){const r=e;return f({title:`${r.status} - ${r.statusText} | ${r.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}a{color:inherit;text-decoration: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: }'}]}),(k,w)=>{const o=d;return i(),a("div",p,[t("div",m,[t("h1",{class:"font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]",textContent:n(e.status)},null,8,h),t("h2",{class:"font-semibold mb-2 sm:text-3xl text-2xl",textContent:n(e.statusText)},null,8,b),t("p",{class:"mb-4 px-2 text-[#64748B] text-md",textContent:n(e.description)},null,8,x),t("div",g,[u(o,{to:"/",class:"font-medium hover:text-[#00DC82] text-sm underline underline-offset-3"},{default:c(()=>[l(n(e.backHome),1)]),_:1})])])])}}},N=s(y,[["__scopeId","data-v-85347797"]]);export{N as default};
1
+ import{_ as s,c as a,o as i,a as t,t as n,b as u,w as c,d as l,e as d}from"./CBbMDhE2.js";import{u as f}from"./BpR-tlZc.js";const p={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"},m={class:"max-w-520px text-center"},h=["textContent"],b=["textContent"],x=["textContent"],g={class:"flex items-center justify-center w-full"},y={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},status:{type:Number,default:404},statusText:{type:String,default:"Page not found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(e){const r=e;return f({title:`${r.status} - ${r.statusText} | ${r.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}a{color:inherit;text-decoration: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: }'}]}),(k,w)=>{const o=d;return i(),a("div",p,[t("div",m,[t("h1",{class:"font-semibold leading-none mb-4 sm:text-[110px] tabular-nums text-[80px]",textContent:n(e.status)},null,8,h),t("h2",{class:"font-semibold mb-2 sm:text-3xl text-2xl",textContent:n(e.statusText)},null,8,b),t("p",{class:"mb-4 px-2 text-[#64748B] text-md",textContent:n(e.description)},null,8,x),t("div",g,[u(o,{to:"/",class:"font-medium hover:text-[#00DC82] text-sm underline underline-offset-3"},{default:c(()=>[l(n(e.backHome),1)]),_:1})])])])}}},N=s(y,[["__scopeId","data-v-85347797"]]);export{N as default};
@@ -1 +1 @@
1
- import{_ as o,c as s,o as a,a as t,t as r}from"./D-kOnTuH.js";import{u as i}from"./Ds2G8aQM.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"./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 +1 @@
1
- {"id":"cc1ba70f-082b-4dc7-8639-5f076fef2cfa","timestamp":1772035753039}
1
+ {"id":"762d443a-0880-424f-bda8-2b32b39d43ec","timestamp":1772420315053}
@@ -0,0 +1 @@
1
+ {"id":"762d443a-0880-424f-bda8-2b32b39d43ec","timestamp":1772420315053,"prerendered":[]}
@@ -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/D-kOnTuH.js"><script type="module" src="/__nuxt-scripts/_nuxt/D-kOnTuH.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:"cc1ba70f-082b-4dc7-8639-5f076fef2cfa",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1772035757664,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/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>
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.4",
7
+ "version": "1.0.0-beta.6",
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';
@@ -302,6 +301,88 @@ function buildProxyConfig(collectPrefix) {
302
301
  [`${collectPrefix}/hotjar-metrics/**`]: { proxy: "https://metrics.hotjar.io/**" },
303
302
  [`${collectPrefix}/hotjar-insights/**`]: { proxy: "https://insights.hotjar.com/**" }
304
303
  }
304
+ },
305
+ plausible: {
306
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
307
+ rewrite: [
308
+ { from: "plausible.io", to: `${collectPrefix}/plausible` }
309
+ ],
310
+ routes: {
311
+ [`${collectPrefix}/plausible/**`]: { proxy: "https://plausible.io/**" }
312
+ }
313
+ },
314
+ cloudflareWebAnalytics: {
315
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
316
+ rewrite: [
317
+ { from: "static.cloudflareinsights.com", to: `${collectPrefix}/cfwa` },
318
+ { from: "cloudflareinsights.com", to: `${collectPrefix}/cfwa-beacon` }
319
+ ],
320
+ routes: {
321
+ [`${collectPrefix}/cfwa/**`]: { proxy: "https://static.cloudflareinsights.com/**" },
322
+ [`${collectPrefix}/cfwa-beacon/**`]: { proxy: "https://cloudflareinsights.com/**" }
323
+ }
324
+ },
325
+ rybbit: {
326
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
327
+ rewrite: [
328
+ { from: "app.rybbit.io", to: `${collectPrefix}/rybbit` }
329
+ ],
330
+ routes: {
331
+ [`${collectPrefix}/rybbit/**`]: { proxy: "https://app.rybbit.io/**" }
332
+ }
333
+ },
334
+ umami: {
335
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
336
+ rewrite: [
337
+ { from: "cloud.umami.is", to: `${collectPrefix}/umami` }
338
+ ],
339
+ routes: {
340
+ [`${collectPrefix}/umami/**`]: { proxy: "https://cloud.umami.is/**" }
341
+ }
342
+ },
343
+ databuddy: {
344
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
345
+ rewrite: [
346
+ { from: "cdn.databuddy.cc", to: `${collectPrefix}/databuddy` },
347
+ { from: "basket.databuddy.cc", to: `${collectPrefix}/databuddy-api` }
348
+ ],
349
+ routes: {
350
+ [`${collectPrefix}/databuddy/**`]: { proxy: "https://cdn.databuddy.cc/**" },
351
+ [`${collectPrefix}/databuddy-api/**`]: { proxy: "https://basket.databuddy.cc/**" }
352
+ }
353
+ },
354
+ fathom: {
355
+ privacy: { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
356
+ rewrite: [
357
+ { from: "cdn.usefathom.com", to: `${collectPrefix}/fathom` }
358
+ ],
359
+ routes: {
360
+ [`${collectPrefix}/fathom/**`]: { proxy: "https://cdn.usefathom.com/**" }
361
+ }
362
+ },
363
+ intercom: {
364
+ privacy: { ip: true, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
365
+ rewrite: [
366
+ { from: "widget.intercom.io", to: `${collectPrefix}/intercom` },
367
+ { from: "api-iam.intercom.io", to: `${collectPrefix}/intercom-api` },
368
+ { from: "api-iam.eu.intercom.io", to: `${collectPrefix}/intercom-api-eu` },
369
+ { from: "api-iam.au.intercom.io", to: `${collectPrefix}/intercom-api-au` }
370
+ ],
371
+ routes: {
372
+ [`${collectPrefix}/intercom/**`]: { proxy: "https://widget.intercom.io/**" },
373
+ [`${collectPrefix}/intercom-api/**`]: { proxy: "https://api-iam.intercom.io/**" },
374
+ [`${collectPrefix}/intercom-api-eu/**`]: { proxy: "https://api-iam.eu.intercom.io/**" },
375
+ [`${collectPrefix}/intercom-api-au/**`]: { proxy: "https://api-iam.au.intercom.io/**" }
376
+ }
377
+ },
378
+ crisp: {
379
+ privacy: { ip: true, userAgent: false, language: false, screen: false, timezone: false, hardware: false },
380
+ rewrite: [
381
+ { from: "client.crisp.chat", to: `${collectPrefix}/crisp` }
382
+ ],
383
+ routes: {
384
+ [`${collectPrefix}/crisp/**`]: { proxy: "https://client.crisp.chat/**" }
385
+ }
305
386
  }
306
387
  };
307
388
  }
@@ -312,20 +393,15 @@ function getProxyConfig(key, collectPrefix) {
312
393
  function getAllProxyConfigs(collectPrefix) {
313
394
  return buildProxyConfig(collectPrefix);
314
395
  }
315
- function getSWInterceptRules(collectPrefix) {
316
- const configs = buildProxyConfig(collectPrefix);
396
+ function routesToInterceptRules(routes) {
317
397
  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
- }
398
+ for (const [localPath, { proxy }] of Object.entries(routes)) {
399
+ const match = proxy.match(/^https?:\/\/([^/]+)(\/.*)?\/\*\*$/);
400
+ if (match?.[1]) {
401
+ const domain = match[1];
402
+ const pathPrefix = match[2] || "";
403
+ const target = localPath.replace(/\/\*\*$/, "");
404
+ rules.push({ pattern: domain, pathPrefix, target });
329
405
  }
330
406
  }
331
407
  return rules;
@@ -358,6 +434,114 @@ function isJS(id) {
358
434
  return JS_RE.test(pathname);
359
435
  }
360
436
 
437
+ function isPropertyKeyAST(parent, ctx) {
438
+ return parent?.type === "Property" && ctx.key === "key" || parent?.type === "SwitchCase" && ctx.key === "test";
439
+ }
440
+ function matchAndRewrite(value, rewrites) {
441
+ for (const { from, to } of rewrites) {
442
+ const isSuffixMatch = from.startsWith(".");
443
+ const fromSlashIdx = from.indexOf("/");
444
+ const fromHost = fromSlashIdx > 0 ? from.slice(0, fromSlashIdx) : from;
445
+ const fromPath = fromSlashIdx > 0 ? from.slice(fromSlashIdx) : "";
446
+ if (!value.includes(fromHost)) continue;
447
+ const url = parseURL(value);
448
+ let shouldRewrite = false;
449
+ let rewriteSuffix = "";
450
+ if (url.host) {
451
+ const hostMatches = isSuffixMatch ? url.host.endsWith(fromHost) : url.host === fromHost;
452
+ if (hostMatches) {
453
+ const fullPath = url.pathname + (url.search || "") + (url.hash || "");
454
+ if (fromPath && fullPath.startsWith(fromPath)) {
455
+ shouldRewrite = true;
456
+ rewriteSuffix = fullPath.slice(fromPath.length);
457
+ } else if (!fromPath) {
458
+ shouldRewrite = true;
459
+ rewriteSuffix = fullPath;
460
+ }
461
+ }
462
+ } else if (value.startsWith("//")) {
463
+ const hostPart = value.slice(2).split("/")[0];
464
+ const hostMatches = isSuffixMatch ? hostPart?.endsWith(fromHost) ?? false : hostPart === fromHost;
465
+ if (hostMatches) {
466
+ const remainder = value.slice(2 + (hostPart?.length ?? 0));
467
+ if (fromPath && remainder.startsWith(fromPath)) {
468
+ shouldRewrite = true;
469
+ rewriteSuffix = remainder.slice(fromPath.length);
470
+ } else if (!fromPath) {
471
+ shouldRewrite = true;
472
+ rewriteSuffix = remainder;
473
+ }
474
+ }
475
+ } else if (fromPath && (value.startsWith(from) || isSuffixMatch && value.includes(from))) {
476
+ const domainEnd = value.indexOf(from) + from.length;
477
+ const nextChar = value[domainEnd];
478
+ if (!nextChar || nextChar === "/" || nextChar === "?" || nextChar === "#") {
479
+ shouldRewrite = true;
480
+ rewriteSuffix = value.slice(domainEnd);
481
+ }
482
+ }
483
+ if (shouldRewrite) {
484
+ return rewriteSuffix === "/" || rewriteSuffix.startsWith("?") || rewriteSuffix.startsWith("#") ? to + rewriteSuffix : joinURL(to, rewriteSuffix);
485
+ }
486
+ }
487
+ return null;
488
+ }
489
+ function rewriteScriptUrlsAST(content, filename, rewrites) {
490
+ const s = new MagicString(content);
491
+ parseAndWalk(content, filename, function(node, parent, ctx) {
492
+ if (node.type === "Literal" && typeof node.value === "string") {
493
+ const value = node.value;
494
+ const rewritten = matchAndRewrite(value, rewrites);
495
+ if (rewritten === null) return;
496
+ const quote = content[node.start];
497
+ if (isPropertyKeyAST(parent, ctx)) {
498
+ s.overwrite(node.start, node.end, quote + rewritten + quote);
499
+ } else {
500
+ s.overwrite(node.start, node.end, "self.location.origin+" + quote + rewritten + quote);
501
+ }
502
+ }
503
+ if (node.type === "TemplateLiteral" && node.expressions?.length === 0) {
504
+ const quasis = node.quasis;
505
+ if (quasis?.length === 1) {
506
+ const value = quasis[0].value?.cooked ?? quasis[0].value?.raw;
507
+ if (typeof value !== "string") return;
508
+ const rewritten = matchAndRewrite(value, rewrites);
509
+ if (rewritten === null) return;
510
+ if (isPropertyKeyAST(parent, ctx)) {
511
+ s.overwrite(node.start, node.end, "`" + rewritten + "`");
512
+ } else {
513
+ s.overwrite(node.start, node.end, "self.location.origin+`" + rewritten + "`");
514
+ }
515
+ }
516
+ }
517
+ if (node.type === "CallExpression") {
518
+ const callee = node.callee;
519
+ if (callee?.type === "MemberExpression" && !callee.computed && callee.object?.type === "Identifier" && callee.object.name === "navigator" && callee.property?.name === "sendBeacon") {
520
+ s.overwrite(callee.start, callee.end, "__nuxtScripts.sendBeacon");
521
+ }
522
+ if (callee?.type === "Identifier" && callee.name === "fetch") {
523
+ s.overwrite(callee.start, callee.end, "__nuxtScripts.fetch");
524
+ }
525
+ 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") {
526
+ s.overwrite(callee.start, callee.end, "__nuxtScripts.fetch");
527
+ }
528
+ }
529
+ });
530
+ let output = s.toString();
531
+ const gaRewrite = rewrites.find((r) => r.from.includes("google-analytics.com/g/collect"));
532
+ if (gaRewrite) {
533
+ output = output.replace(
534
+ /"https:\/\/"\+\(.*?\)\+"\.google-analytics\.com\/g\/collect"/g,
535
+ `self.location.origin+"${gaRewrite.to}"`
536
+ );
537
+ output = output.replace(
538
+ /"https:\/\/"\+\(.*?\)\+"\.analytics\.google\.com\/g\/collect"/g,
539
+ `self.location.origin+"${gaRewrite.to}"`
540
+ );
541
+ }
542
+ return output;
543
+ }
544
+
361
545
  const SEVEN_DAYS_IN_MS = 7 * 24 * 60 * 60 * 1e3;
362
546
  function calculateIntegrity(content, algorithm = "sha384") {
363
547
  const hash = createHash(algorithm).update(content).digest("base64");
@@ -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 = 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,6 +65,7 @@ async function registry(resolve) {
62
65
  },
63
66
  {
64
67
  label: "Rybbit Analytics",
68
+ proxy: "rybbit",
65
69
  category: "analytics",
66
70
  logo: `https://www.rybbit.io/rybbit.png`,
67
71
  import: {
@@ -71,6 +75,7 @@ async function registry(resolve) {
71
75
  },
72
76
  {
73
77
  label: "Databuddy Analytics",
78
+ proxy: "databuddy",
74
79
  category: "analytics",
75
80
  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
81
  import: {
@@ -156,6 +161,7 @@ async function registry(resolve) {
156
161
  // ads
157
162
  {
158
163
  label: "Google Adsense",
164
+ proxy: "googleAnalytics",
159
165
  scriptBundling: (options) => {
160
166
  if (!options?.client) {
161
167
  return false;
@@ -180,6 +186,7 @@ async function registry(resolve) {
180
186
  // marketing
181
187
  {
182
188
  label: "Intercom",
189
+ proxy: "intercom",
183
190
  scriptBundling(options) {
184
191
  if (!options?.app_id) {
185
192
  return false;
@@ -291,6 +298,7 @@ async function registry(resolve) {
291
298
  // chat
292
299
  {
293
300
  label: "Crisp",
301
+ proxy: "crisp",
294
302
  category: "support",
295
303
  logo: {
296
304
  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 +396,7 @@ async function registry(resolve) {
388
396
  },
389
397
  {
390
398
  label: "Umami Analytics",
399
+ proxy: "umami",
391
400
  category: "analytics",
392
401
  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
402
  import: {
@@ -48,7 +48,9 @@ export function useScriptPostHog(_options) {
48
48
  return;
49
49
  }
50
50
  const region = options?.region || "us";
51
- const apiHost = options?.apiHost || (region === "eu" ? "https://eu.i.posthog.com" : "https://us.i.posthog.com");
51
+ let apiHost = options?.apiHost || (region === "eu" ? "https://eu.i.posthog.com" : "https://us.i.posthog.com");
52
+ if (apiHost.startsWith("/"))
53
+ apiHost = window.location.origin + apiHost;
52
54
  window.__posthogInitPromise = import("posthog-js").then(({ default: posthog }) => {
53
55
  const config = {
54
56
  api_host: apiHost,