@nuxt/scripts 1.0.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/devtools-client/200.html +1 -1
- package/dist/devtools-client/404.html +1 -1
- package/dist/devtools-client/_nuxt/{YlRaZkPa.js → 1wb58MKb.js} +1 -1
- package/dist/devtools-client/_nuxt/{CZp-OuKP.js → BbLmrp_o.js} +1 -1
- package/dist/devtools-client/_nuxt/{DyyF3uw_.js → Cx46cS8a.js} +1 -1
- package/dist/devtools-client/_nuxt/{Djr8-0jV.js → D-M51CV3.js} +1 -1
- package/dist/devtools-client/_nuxt/D4HTNcLU.js +188 -0
- package/dist/devtools-client/_nuxt/{W-xcwSaJ.js → DU3BlAm5.js} +1 -1
- package/dist/devtools-client/_nuxt/{GzJXdFDa.js → DiaY4J4_.js} +1 -1
- package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
- package/dist/devtools-client/_nuxt/builds/meta/0b4ab733-07a6-40b2-b25e-aca95fa55188.json +1 -0
- package/dist/devtools-client/_nuxt/error-404.D2T48gBS.css +1 -0
- package/dist/devtools-client/_nuxt/error-500.sMTZJbsP.css +1 -0
- package/dist/devtools-client/docs/index.html +1 -1
- package/dist/devtools-client/first-party/index.html +1 -1
- package/dist/devtools-client/index.html +1 -1
- package/dist/devtools-client/registry/index.html +1 -1
- package/dist/module.d.mts +7 -1
- package/dist/module.d.ts +7 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +266 -34
- package/dist/registry.mjs +76 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +36 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.d.vue.ts +2 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue.d.ts +2 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.d.vue.ts +2 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue.d.ts +2 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.d.vue.ts +2 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue.d.ts +2 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.d.vue.ts +2 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue.d.ts +2 -2
- package/dist/runtime/components/ScriptCalendlyInlineWidget.d.vue.ts +59 -0
- package/dist/runtime/components/ScriptCalendlyInlineWidget.vue +79 -0
- package/dist/runtime/components/ScriptCalendlyInlineWidget.vue.d.ts +59 -0
- package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +1 -1
- package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +1 -1
- package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +1 -1
- package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +1 -1
- package/dist/runtime/composables/useScript.js +48 -0
- package/dist/runtime/debug.d.ts +1 -0
- package/dist/runtime/debug.js +1 -0
- package/dist/runtime/devtools-standalone-bridge.client.js +3 -1
- package/dist/runtime/logger.js +4 -0
- package/dist/runtime/registry/_gcm-consent.d.ts +14 -0
- package/dist/runtime/registry/_gcm-consent.js +24 -0
- package/dist/runtime/registry/ahrefs-analytics.d.ts +39 -0
- package/dist/runtime/registry/ahrefs-analytics.js +18 -0
- package/dist/runtime/registry/calendly.d.ts +76 -0
- package/dist/runtime/registry/calendly.js +63 -0
- package/dist/runtime/registry/google-analytics.d.ts +5 -6
- package/dist/runtime/registry/google-analytics.js +4 -10
- package/dist/runtime/registry/google-tag-manager.d.ts +5 -6
- package/dist/runtime/registry/google-tag-manager.js +13 -18
- package/dist/runtime/registry/linkedin-insight.d.ts +35 -0
- package/dist/runtime/registry/linkedin-insight.js +49 -0
- package/dist/runtime/registry/schemas.d.ts +124 -0
- package/dist/runtime/registry/schemas.js +115 -2
- package/dist/runtime/registry/tiktok-pixel.d.ts +28 -2
- package/dist/runtime/registry/tiktok-pixel.js +18 -1
- package/dist/runtime/registry/usercentrics.d.ts +85 -0
- package/dist/runtime/registry/usercentrics.js +54 -0
- package/dist/runtime/server/proxy-handler.js +13 -4
- package/dist/runtime/types.d.ts +36 -1
- package/dist/runtime/utils.d.ts +8 -2
- package/dist/runtime/utils.js +5 -1
- package/dist/stats.mjs +19 -0
- package/dist/types-source.mjs +274 -9
- package/dist/types.d.mts +1 -1
- package/package.json +9 -6
- package/dist/devtools-client/_nuxt/DtB6K90V.js +0 -188
- package/dist/devtools-client/_nuxt/builds/meta/57f43375-6c5e-40af-a5bc-9479e5286aac.json +0 -1
- package/dist/devtools-client/_nuxt/error-404.DsZYSkA7.css +0 -1
- package/dist/devtools-client/_nuxt/error-500.Cqipl6_j.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as s,o,c as n,a as l,_ as r,g as a}from"./
|
|
1
|
+
import{f as s,o,c as n,a as l,_ as r,g as a}from"./D4HTNcLU.js";const _={class:"h-full max-h-full overflow-hidden"},u=["src","title"],i=s({__name:"DevtoolsDocs",props:{url:{}},setup(e){return(c,t)=>(o(),n("div",_,[l("iframe",{src:e.url,title:`Documentation - ${e.url}`,class:"w-full h-full border-none",style:{"min-height":"calc(100vh - 100px)"}},null,8,u)]))}}),f=Object.assign(i,{__name:"DevtoolsDocs"}),m={};function d(e,c){const t=f;return o(),a(t,{url:"https://scripts.nuxt.com"})}const p=r(m,[["render",d]]);export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as s,u as a,o as i,c as u,a as t,t as n,b as c,w as l,d,e as f}from"./
|
|
1
|
+
import{_ as s,u as a,o as i,c as u,a as t,t as n,b as c,w as l,d,e as f}from"./D4HTNcLU.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 a({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=f;return i(),u("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,[c(o,{to:"/",class:"font-medium hover:text-[#00DC82] text-sm underline underline-offset-3"},{default:l(()=>[d(n(e.backHome),1)]),_:1})])])])}}},v=s(y,[["__scopeId","data-v-97910b38"]]);export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"0b4ab733-07a6-40b2-b25e-aca95fa55188","timestamp":1778775639600}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"0b4ab733-07a6-40b2-b25e-aca95fa55188","timestamp":1778775639600,"prerendered":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.grid[data-v-97910b38]{display:grid}.mb-2[data-v-97910b38]{margin-bottom:.5rem}.mb-4[data-v-97910b38]{margin-bottom:1rem}.max-w-520px[data-v-97910b38]{max-width:520px}.min-h-screen[data-v-97910b38]{min-height:100vh}.w-full[data-v-97910b38]{width:100%}.flex[data-v-97910b38]{display:flex}.place-content-center[data-v-97910b38]{place-content:center}.items-center[data-v-97910b38]{align-items:center}.justify-center[data-v-97910b38]{justify-content:center}.overflow-hidden[data-v-97910b38]{overflow:hidden}.bg-white[data-v-97910b38]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2[data-v-97910b38]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-97910b38]{text-align:center}.text-\[80px\][data-v-97910b38]{font-size:80px}.text-2xl[data-v-97910b38]{font-size:1.5rem;line-height:2rem}.text-sm[data-v-97910b38]{font-size:.875rem;line-height:1.25rem}.text-\[\#020420\][data-v-97910b38]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\[\#64748B\][data-v-97910b38]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.hover\:text-\[\#00DC82\][data-v-97910b38]:hover{--un-text-opacity:1;color:rgb(0 220 130/var(--un-text-opacity))}.font-medium[data-v-97910b38]{font-weight:500}.font-semibold[data-v-97910b38]{font-weight:600}.leading-none[data-v-97910b38]{line-height:1}.tracking-wide[data-v-97910b38]{letter-spacing:.025em}.font-sans[data-v-97910b38]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-97910b38]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.underline[data-v-97910b38]{text-decoration-line:underline}.underline-offset-3[data-v-97910b38]{text-underline-offset:3px}.antialiased[data-v-97910b38]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-\[\#020420\][data-v-97910b38]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\:text-white[data-v-97910b38]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:text-\[110px\][data-v-97910b38]{font-size:110px}.sm\:text-3xl[data-v-97910b38]{font-size:1.875rem;line-height:2.25rem}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.grid[data-v-29f31f54]{display:grid}.mb-2[data-v-29f31f54]{margin-bottom:.5rem}.mb-4[data-v-29f31f54]{margin-bottom:1rem}.max-w-520px[data-v-29f31f54]{max-width:520px}.min-h-screen[data-v-29f31f54]{min-height:100vh}.place-content-center[data-v-29f31f54]{place-content:center}.overflow-hidden[data-v-29f31f54]{overflow:hidden}.bg-white[data-v-29f31f54]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-2[data-v-29f31f54]{padding-left:.5rem;padding-right:.5rem}.text-center[data-v-29f31f54]{text-align:center}.text-\[80px\][data-v-29f31f54]{font-size:80px}.text-2xl[data-v-29f31f54]{font-size:1.5rem;line-height:2rem}.text-\[\#020420\][data-v-29f31f54]{--un-text-opacity:1;color:rgb(2 4 32/var(--un-text-opacity))}.text-\[\#64748B\][data-v-29f31f54]{--un-text-opacity:1;color:rgb(100 116 139/var(--un-text-opacity))}.font-semibold[data-v-29f31f54]{font-weight:600}.leading-none[data-v-29f31f54]{line-height:1}.tracking-wide[data-v-29f31f54]{letter-spacing:.025em}.font-sans[data-v-29f31f54]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.tabular-nums[data-v-29f31f54]{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal) var(--un-slashed-zero) var(--un-numeric-figure) var(--un-numeric-spacing) var(--un-numeric-fraction)}.antialiased[data-v-29f31f54]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-\[\#020420\][data-v-29f31f54]{--un-bg-opacity:1;background-color:rgb(2 4 32/var(--un-bg-opacity))}.dark\:text-white[data-v-29f31f54]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:text-\[110px\][data-v-29f31f54]{font-size:110px}.sm\:text-3xl[data-v-29f31f54]{font-size:1.875rem;line-height:2.25rem}}
|
|
@@ -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.XOvcedFq.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
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.XOvcedFq.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/D4HTNcLU.js"><script type="module" src="/__nuxt-scripts/_nuxt/D4HTNcLU.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-scripts",buildId:"0b4ab733-07a6-40b2-b25e-aca95fa55188",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1778775649033,false]</script></body></html>
|
|
@@ -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.XOvcedFq.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
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.XOvcedFq.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/D4HTNcLU.js"><script type="module" src="/__nuxt-scripts/_nuxt/D4HTNcLU.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-scripts",buildId:"0b4ab733-07a6-40b2-b25e-aca95fa55188",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1778775649034,false]</script></body></html>
|
|
@@ -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.XOvcedFq.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
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.XOvcedFq.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/D4HTNcLU.js"><script type="module" src="/__nuxt-scripts/_nuxt/D4HTNcLU.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-scripts",buildId:"0b4ab733-07a6-40b2-b25e-aca95fa55188",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1778775649035,false]</script></body></html>
|
|
@@ -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.XOvcedFq.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/
|
|
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.XOvcedFq.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/D4HTNcLU.js"><script type="module" src="/__nuxt-scripts/_nuxt/D4HTNcLU.js" crossorigin></script><script>"use strict";(()=>{const t=window,e=document.documentElement,c=["dark","light"],n=getStorageValue("localStorage","nuxt-color-mode")||"system";let i=n==="system"?u():n;const r=e.getAttribute("data-color-mode-forced");r&&(i=r),l(i),t["__NUXT_COLOR_MODE__"]={preference:n,value:i,getColorScheme:u,addColorScheme:l,removeColorScheme:d};function l(o){const s=""+o+"",a="";e.classList?e.classList.add(s):e.className+=" "+s,a&&e.setAttribute("data-"+a,o)}function d(o){const s=""+o+"",a="";e.classList?e.classList.remove(s):e.className=e.className.replace(new RegExp(s,"g"),""),a&&e.removeAttribute("data-"+a)}function f(o){return t.matchMedia("(prefers-color-scheme"+o+")")}function u(){if(t.matchMedia&&f("").media!=="not all"){for(const o of c)if(f(":"+o).matches)return o}return"light"}})();function getStorageValue(t,e){switch(t){case"localStorage":return window.localStorage.getItem(e);case"sessionStorage":return window.sessionStorage.getItem(e);case"cookie":return getCookie(e);default:return null}}function getCookie(t){const c=("; "+window.document.cookie).split("; "+t+"=");if(c.length===2)return c.pop()?.split(";").shift()}</script></head><body><div id="__nuxt" class="isolate"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-scripts",buildId:"0b4ab733-07a6-40b2-b25e-aca95fa55188",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1778775649034,false]</script></body></html>
|
package/dist/module.d.mts
CHANGED
|
@@ -23,6 +23,12 @@ declare function resolveProxySecret(rootDir: string, isDev: boolean, configSecre
|
|
|
23
23
|
declare function isProxyDisabled(registryKey: string, registry?: NuxtConfigScriptRegistry, runtimeConfig?: Record<string, any>): boolean;
|
|
24
24
|
declare function applyAutoInject(registry: NuxtConfigScriptRegistry, runtimeConfig: Record<string, any>, proxyPrefix: string, registryKey: string, autoInject: ResolvedProxyAutoInject): void;
|
|
25
25
|
declare function resolveConfiguredProxyDomains(config: Record<string, any> | undefined, proxyConfig?: Pick<ProxyConfig, 'autoInject' | 'configDomainFields'>): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Compute missing required fields for a registry entry, using the merged
|
|
28
|
+
* runtimeConfig as source of truth so that env vars and runtimeConfig.public.scripts
|
|
29
|
+
* count toward satisfying the schema.
|
|
30
|
+
*/
|
|
31
|
+
declare function findMissingRequiredFields(requiredFields: string[], rawInput: Record<string, any> | undefined, mergedPublicScript: Record<string, any> | undefined): string[];
|
|
26
32
|
interface ModuleOptions {
|
|
27
33
|
/**
|
|
28
34
|
* Base path prefix for all script endpoints (proxy and bundled assets).
|
|
@@ -182,5 +188,5 @@ interface ModuleHooks {
|
|
|
182
188
|
}
|
|
183
189
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
184
190
|
|
|
185
|
-
export { applyAutoInject, _default as default, isProxyDisabled, resolveConfiguredProxyDomains, resolveProxySecret };
|
|
191
|
+
export { applyAutoInject, _default as default, findMissingRequiredFields, isProxyDisabled, resolveConfiguredProxyDomains, resolveProxySecret };
|
|
186
192
|
export type { ModuleHooks, ModuleOptions, ResolvedProxySecret };
|
package/dist/module.d.ts
CHANGED
|
@@ -23,6 +23,12 @@ declare function resolveProxySecret(rootDir: string, isDev: boolean, configSecre
|
|
|
23
23
|
declare function isProxyDisabled(registryKey: string, registry?: NuxtConfigScriptRegistry, runtimeConfig?: Record<string, any>): boolean;
|
|
24
24
|
declare function applyAutoInject(registry: NuxtConfigScriptRegistry, runtimeConfig: Record<string, any>, proxyPrefix: string, registryKey: string, autoInject: ResolvedProxyAutoInject): void;
|
|
25
25
|
declare function resolveConfiguredProxyDomains(config: Record<string, any> | undefined, proxyConfig?: Pick<ProxyConfig, 'autoInject' | 'configDomainFields'>): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Compute missing required fields for a registry entry, using the merged
|
|
28
|
+
* runtimeConfig as source of truth so that env vars and runtimeConfig.public.scripts
|
|
29
|
+
* count toward satisfying the schema.
|
|
30
|
+
*/
|
|
31
|
+
declare function findMissingRequiredFields(requiredFields: string[], rawInput: Record<string, any> | undefined, mergedPublicScript: Record<string, any> | undefined): string[];
|
|
26
32
|
interface ModuleOptions {
|
|
27
33
|
/**
|
|
28
34
|
* Base path prefix for all script endpoints (proxy and bundled assets).
|
|
@@ -182,5 +188,5 @@ interface ModuleHooks {
|
|
|
182
188
|
}
|
|
183
189
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
184
190
|
|
|
185
|
-
export { applyAutoInject, _default as default, isProxyDisabled, resolveConfiguredProxyDomains, resolveProxySecret };
|
|
191
|
+
export { applyAutoInject, _default as default, findMissingRequiredFields, isProxyDisabled, resolveConfiguredProxyDomains, resolveProxySecret };
|
|
186
192
|
export type { ModuleHooks, ModuleOptions, ResolvedProxySecret };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { useNuxt, addDevServerHandler, extendRouteRules, tryUseNuxt, createResol
|
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import { join, resolve } from 'pathe';
|
|
6
6
|
import { resolvePackageJSON, readPackageJSON } from 'pkg-types';
|
|
7
|
-
import { lazyEventHandler, eventHandler, createError } from 'h3';
|
|
7
|
+
import { lazyEventHandler, eventHandler, createError, setHeader } from 'h3';
|
|
8
8
|
import { fetch, $fetch } from 'ofetch';
|
|
9
9
|
import { joinURL, parseURL, parseQuery, hasProtocol } from 'ufo';
|
|
10
10
|
import { createStorage } from 'unstorage';
|
|
@@ -42,6 +42,7 @@ function setupPublicAssetStrategy(assetsBaseURL) {
|
|
|
42
42
|
const scriptDescriptor = renderedScript.get(join(assetsBaseURL, cleanPath));
|
|
43
43
|
if (!scriptDescriptor || scriptDescriptor instanceof Error)
|
|
44
44
|
throw createError({ statusCode: 404 });
|
|
45
|
+
setHeader(event, "content-type", "application/javascript; charset=utf-8");
|
|
45
46
|
if (scriptDescriptor.content) {
|
|
46
47
|
return scriptDescriptor.content;
|
|
47
48
|
}
|
|
@@ -739,6 +740,21 @@ function rewriteScriptUrlsAST(content, filename, rewrites, sdkPatches, options)
|
|
|
739
740
|
}
|
|
740
741
|
}
|
|
741
742
|
}
|
|
743
|
+
if (sdkPatches?.some((p) => p.type === "replace-new-url-origin") && node.type === "MemberExpression" && !node.computed) {
|
|
744
|
+
const obj = node.object;
|
|
745
|
+
const prop = node.property;
|
|
746
|
+
if (prop?.type === "Identifier" && prop.name === "origin" && obj?.type === "NewExpression" && obj.callee?.type === "Identifier" && obj.callee.name === "URL" && obj.arguments?.length >= 1) {
|
|
747
|
+
for (const patch of sdkPatches) {
|
|
748
|
+
if (patch.type !== "replace-new-url-origin")
|
|
749
|
+
continue;
|
|
750
|
+
const rewrite = rewrites.find((r) => r.from === patch.fromDomain);
|
|
751
|
+
if (!rewrite)
|
|
752
|
+
continue;
|
|
753
|
+
s.overwrite(node.start, node.end, `${needsLeadingSpace(node.start)}(self.location.origin+"${rewrite.to}")`);
|
|
754
|
+
break;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
742
758
|
if (node.type === "NewExpression" && !options?.skipApiRewrites) {
|
|
743
759
|
const callee = node.callee;
|
|
744
760
|
if (callee?.type === "Identifier" && callee.name === "XMLHttpRequest") {
|
|
@@ -1159,17 +1175,25 @@ function registerTypeTemplates({ config, newScripts }) {
|
|
|
1159
1175
|
addTypeTemplate({
|
|
1160
1176
|
filename: "types/nuxt-scripts-augments.d.ts",
|
|
1161
1177
|
getContents: () => {
|
|
1178
|
+
const globalsKeys = Object.keys(config.globals || {});
|
|
1162
1179
|
let augments = `// Generated by @nuxt/scripts
|
|
1163
1180
|
declare module '#app' {
|
|
1164
1181
|
interface NuxtApp {
|
|
1165
|
-
$scripts: Record<${[...[...
|
|
1182
|
+
$scripts: Record<${[...[...globalsKeys, ...Object.keys(config.registry || {})].map((k) => `'${k}'`), ...["string"]].join(" | ")}, import('#nuxt-scripts/types').UseScriptContext<any> | undefined>
|
|
1166
1183
|
_scripts: Record<string, import('#nuxt-scripts/types').NuxtDevToolsScriptInstance>
|
|
1167
1184
|
}
|
|
1168
1185
|
interface RuntimeNuxtHooks {
|
|
1169
1186
|
'scripts:updated': (ctx: { scripts: Record<string, import('#nuxt-scripts/types').NuxtDevToolsScriptInstance> }) => void | Promise<void>
|
|
1170
1187
|
}
|
|
1171
1188
|
}
|
|
1172
|
-
|
|
1189
|
+
${globalsKeys.length ? `declare module '@nuxt/schema' {
|
|
1190
|
+
interface PublicRuntimeConfig {
|
|
1191
|
+
scriptsGlobals?: {
|
|
1192
|
+
${globalsKeys.map((k) => ` ${JSON.stringify(k)}?: Record<string, any>`).join("\n")}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
` : ""}`;
|
|
1173
1197
|
if (newScripts.length) {
|
|
1174
1198
|
augments += `
|
|
1175
1199
|
declare module '#nuxt-scripts/types' {
|
|
@@ -1269,41 +1293,57 @@ function templatePlugin(config, registry) {
|
|
|
1269
1293
|
inits.push(`const ${k} = ${importDefinition.import.name}(${argsJson})`);
|
|
1270
1294
|
}
|
|
1271
1295
|
}
|
|
1296
|
+
const hasGlobals = Object.keys(config.globals || {}).length > 0;
|
|
1272
1297
|
for (const [k, c] of Object.entries(config.globals || {})) {
|
|
1298
|
+
let buildInput;
|
|
1299
|
+
let extraOptions;
|
|
1273
1300
|
if (typeof c === "string") {
|
|
1274
|
-
|
|
1301
|
+
buildInput = { src: c };
|
|
1275
1302
|
} else if (Array.isArray(c) && c.length === 2) {
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
if (triggerResolved) {
|
|
1279
|
-
if (triggerResolved.includes("useScriptTriggerIdleTimeout"))
|
|
1280
|
-
needsIdleTimeoutImport = true;
|
|
1281
|
-
if (triggerResolved.includes("useScriptTriggerInteraction"))
|
|
1282
|
-
needsInteractionImport = true;
|
|
1283
|
-
if (triggerResolved.includes("useScriptTriggerServiceWorker"))
|
|
1284
|
-
needsServiceWorkerImport = true;
|
|
1285
|
-
const resolvedOptions = { ...options, trigger: "__TRIGGER_PLACEHOLDER__" };
|
|
1286
|
-
const optionsJson = JSON.stringify(resolvedOptions).replace(TRIGGER_PLACEHOLDER_RE, triggerResolved);
|
|
1287
|
-
inits.push(`const ${k} = useScript(${JSON.stringify({ key: k, ...typeof c[0] === "string" ? { src: c[0] } : c[0] })}, { ...${optionsJson}, use: () => ({ ${k}: window.${k} }) })`);
|
|
1288
|
-
} else {
|
|
1289
|
-
inits.push(`const ${k} = useScript(${JSON.stringify({ key: k, ...typeof c[0] === "string" ? { src: c[0] } : c[0] })}, { ...${JSON.stringify(c[1])}, use: () => ({ ${k}: window.${k} }) })`);
|
|
1290
|
-
}
|
|
1303
|
+
buildInput = typeof c[0] === "string" ? { src: c[0] } : { ...c[0] };
|
|
1304
|
+
extraOptions = c[1];
|
|
1291
1305
|
} else if (typeof c === "object" && c !== null) {
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1306
|
+
buildInput = { ...c };
|
|
1307
|
+
} else {
|
|
1308
|
+
continue;
|
|
1309
|
+
}
|
|
1310
|
+
const inputTrigger = buildInput.trigger;
|
|
1311
|
+
const inputTriggerResolved = resolveTriggerForTemplate(inputTrigger);
|
|
1312
|
+
if (inputTriggerResolved)
|
|
1313
|
+
buildInput.trigger = "__TRIGGER_PLACEHOLDER__";
|
|
1314
|
+
let buildInputJson = JSON.stringify(buildInput);
|
|
1315
|
+
if (inputTriggerResolved)
|
|
1316
|
+
buildInputJson = buildInputJson.replace(TRIGGER_PLACEHOLDER_RE, inputTriggerResolved);
|
|
1317
|
+
const inputExpr = `Object.assign({ key: ${JSON.stringify(k)} }, ${buildInputJson}, __scriptsGlobals[${JSON.stringify(k)}] || {})`;
|
|
1318
|
+
let optionsJson = "";
|
|
1319
|
+
if (extraOptions && Object.keys(extraOptions).length > 0) {
|
|
1320
|
+
const optsCopy = { ...extraOptions };
|
|
1321
|
+
const optsTriggerResolved = resolveTriggerForTemplate(optsCopy.trigger);
|
|
1322
|
+
if (optsTriggerResolved)
|
|
1323
|
+
optsCopy.trigger = "__TRIGGER_PLACEHOLDER__";
|
|
1324
|
+
optionsJson = JSON.stringify(optsCopy);
|
|
1325
|
+
if (optsTriggerResolved)
|
|
1326
|
+
optionsJson = optionsJson.replace(TRIGGER_PLACEHOLDER_RE, optsTriggerResolved);
|
|
1327
|
+
if (optsTriggerResolved) {
|
|
1328
|
+
if (optsTriggerResolved.includes("useScriptTriggerIdleTimeout"))
|
|
1295
1329
|
needsIdleTimeoutImport = true;
|
|
1296
|
-
if (
|
|
1330
|
+
if (optsTriggerResolved.includes("useScriptTriggerInteraction"))
|
|
1297
1331
|
needsInteractionImport = true;
|
|
1298
|
-
if (
|
|
1332
|
+
if (optsTriggerResolved.includes("useScriptTriggerServiceWorker"))
|
|
1299
1333
|
needsServiceWorkerImport = true;
|
|
1300
|
-
const resolvedOptions = { ...c, trigger: "__TRIGGER_PLACEHOLDER__" };
|
|
1301
|
-
const argsJson = JSON.stringify({ key: k, ...resolvedOptions }).replace(TRIGGER_PLACEHOLDER_RE, triggerResolved);
|
|
1302
|
-
inits.push(`const ${k} = useScript(${argsJson}, { use: () => ({ ${k}: window.${k} }) })`);
|
|
1303
|
-
} else {
|
|
1304
|
-
inits.push(`const ${k} = useScript(${JSON.stringify({ key: k, ...c })}, { use: () => ({ ${k}: window.${k} }) })`);
|
|
1305
1334
|
}
|
|
1306
1335
|
}
|
|
1336
|
+
if (inputTriggerResolved) {
|
|
1337
|
+
if (inputTriggerResolved.includes("useScriptTriggerIdleTimeout"))
|
|
1338
|
+
needsIdleTimeoutImport = true;
|
|
1339
|
+
if (inputTriggerResolved.includes("useScriptTriggerInteraction"))
|
|
1340
|
+
needsInteractionImport = true;
|
|
1341
|
+
if (inputTriggerResolved.includes("useScriptTriggerServiceWorker"))
|
|
1342
|
+
needsServiceWorkerImport = true;
|
|
1343
|
+
}
|
|
1344
|
+
const useFn = `use: () => ({ ${k}: window.${k} })`;
|
|
1345
|
+
const optionsArg = optionsJson ? `{ ...${optionsJson}, ${useFn} }` : `{ ${useFn} }`;
|
|
1346
|
+
inits.push(`const ${k} = useScript(${inputExpr}, ${optionsArg})`);
|
|
1307
1347
|
}
|
|
1308
1348
|
const triggerImports = [];
|
|
1309
1349
|
if (needsIdleTimeoutImport) {
|
|
@@ -1315,9 +1355,14 @@ function templatePlugin(config, registry) {
|
|
|
1315
1355
|
if (needsServiceWorkerImport) {
|
|
1316
1356
|
triggerImports.push(`import { useScriptTriggerServiceWorker } from '#nuxt-scripts/composables/useScriptTriggerServiceWorker'`);
|
|
1317
1357
|
}
|
|
1358
|
+
const setupBody = [];
|
|
1359
|
+
if (hasGlobals)
|
|
1360
|
+
setupBody.push(` const __scriptsGlobals = useRuntimeConfig().public.scriptsGlobals || {}`);
|
|
1361
|
+
setupBody.push(...inits.map((i) => ` ${i}`));
|
|
1362
|
+
setupBody.push(` return { provide: { scripts: { ${[...Object.keys(config.globals || {}), ...resolvedRegistryKeys].join(", ")} } } }`);
|
|
1318
1363
|
return [
|
|
1319
1364
|
`import { useScript } from '#nuxt-scripts/composables/useScript'`,
|
|
1320
|
-
`import { defineNuxtPlugin } from 'nuxt/app'`,
|
|
1365
|
+
`import { defineNuxtPlugin${hasGlobals ? ", useRuntimeConfig" : ""} } from 'nuxt/app'`,
|
|
1321
1366
|
...triggerImports,
|
|
1322
1367
|
...imports,
|
|
1323
1368
|
"",
|
|
@@ -1326,13 +1371,164 @@ function templatePlugin(config, registry) {
|
|
|
1326
1371
|
` env: { islands: false },`,
|
|
1327
1372
|
` parallel: true,`,
|
|
1328
1373
|
` setup() {`,
|
|
1329
|
-
...
|
|
1330
|
-
` return { provide: { scripts: { ${[...Object.keys(config.globals || {}), ...resolvedRegistryKeys].join(", ")} } } }`,
|
|
1374
|
+
...setupBody,
|
|
1331
1375
|
` }`,
|
|
1332
1376
|
`})`
|
|
1333
1377
|
].join("\n");
|
|
1334
1378
|
}
|
|
1335
1379
|
|
|
1380
|
+
const UPPER_RE$1 = /([A-Z])/g;
|
|
1381
|
+
const toScreamingSnake$1 = (s) => s.replace(UPPER_RE$1, "_$1").toUpperCase();
|
|
1382
|
+
const ENV_PREFIX = "NUXT_PUBLIC_SCRIPTS_";
|
|
1383
|
+
const GLOBALS_ENV_PREFIX = "NUXT_PUBLIC_SCRIPTS_GLOBALS_";
|
|
1384
|
+
function levenshtein(a, b) {
|
|
1385
|
+
if (a === b)
|
|
1386
|
+
return 0;
|
|
1387
|
+
if (!a.length)
|
|
1388
|
+
return b.length;
|
|
1389
|
+
if (!b.length)
|
|
1390
|
+
return a.length;
|
|
1391
|
+
const prev = [];
|
|
1392
|
+
for (let j = 0; j <= b.length; j++) prev.push(j);
|
|
1393
|
+
for (let i = 1; i <= a.length; i++) {
|
|
1394
|
+
let prevDiag = prev[0];
|
|
1395
|
+
prev[0] = i;
|
|
1396
|
+
for (let j = 1; j <= b.length; j++) {
|
|
1397
|
+
const tmp = prev[j];
|
|
1398
|
+
prev[j] = a[i - 1] === b[j - 1] ? prevDiag : Math.min(prevDiag, prev[j], prev[j - 1]) + 1;
|
|
1399
|
+
prevDiag = tmp;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return prev[b.length];
|
|
1403
|
+
}
|
|
1404
|
+
function validateScriptsEnvVars(scripts, enabledRegistryKeys, logger, globalsKeys = []) {
|
|
1405
|
+
const validGlobalsByScreaming = /* @__PURE__ */ new Map();
|
|
1406
|
+
for (const k of globalsKeys)
|
|
1407
|
+
validGlobalsByScreaming.set(toScreamingSnake$1(k), k);
|
|
1408
|
+
const validByKey = /* @__PURE__ */ new Map();
|
|
1409
|
+
for (const s of scripts) {
|
|
1410
|
+
if (!s.registryKey || !s.envDefaults || !Object.keys(s.envDefaults).length)
|
|
1411
|
+
continue;
|
|
1412
|
+
const screaming = toScreamingSnake$1(s.registryKey);
|
|
1413
|
+
const fields = new Set(Object.keys(s.envDefaults).map(toScreamingSnake$1));
|
|
1414
|
+
validByKey.set(screaming, { camel: s.registryKey, fields });
|
|
1415
|
+
}
|
|
1416
|
+
if (!validByKey.size && !validGlobalsByScreaming.size)
|
|
1417
|
+
return;
|
|
1418
|
+
const allValidEnvKeys = [];
|
|
1419
|
+
for (const [screaming, { fields }] of validByKey) {
|
|
1420
|
+
for (const f of fields)
|
|
1421
|
+
allValidEnvKeys.push(`${ENV_PREFIX}${screaming}_${f}`);
|
|
1422
|
+
}
|
|
1423
|
+
for (const envKey of Object.keys(process.env)) {
|
|
1424
|
+
if (!envKey.startsWith(ENV_PREFIX))
|
|
1425
|
+
continue;
|
|
1426
|
+
if (envKey.startsWith(GLOBALS_ENV_PREFIX)) {
|
|
1427
|
+
if (!validGlobalsByScreaming.size)
|
|
1428
|
+
continue;
|
|
1429
|
+
const segment2 = envKey.slice(GLOBALS_ENV_PREFIX.length);
|
|
1430
|
+
const segmentParts2 = segment2.split("_");
|
|
1431
|
+
let matched = false;
|
|
1432
|
+
for (const [screaming] of validGlobalsByScreaming) {
|
|
1433
|
+
const keyParts = screaming.split("_");
|
|
1434
|
+
if (segmentParts2.length > keyParts.length && keyParts.every((p, i) => segmentParts2[i] === p)) {
|
|
1435
|
+
matched = true;
|
|
1436
|
+
break;
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
if (matched)
|
|
1440
|
+
continue;
|
|
1441
|
+
let best;
|
|
1442
|
+
for (const [screaming, camel] of validGlobalsByScreaming) {
|
|
1443
|
+
const head = segmentParts2.slice(0, screaming.split("_").length).join("_");
|
|
1444
|
+
const d = levenshtein(head, screaming);
|
|
1445
|
+
if (!best || d < best.dist)
|
|
1446
|
+
best = { screaming, camel, dist: d };
|
|
1447
|
+
}
|
|
1448
|
+
const suggestion2 = best && best.dist <= Math.max(2, Math.floor(best.screaming.length / 2)) ? ` Did you mean globals key \`${best.camel}\` (\`${GLOBALS_ENV_PREFIX}${best.screaming}_*\`)?` : ` Configured globals: ${[...validGlobalsByScreaming.values()].map((k) => `\`${k}\``).join(", ")}.`;
|
|
1449
|
+
logger.warn(
|
|
1450
|
+
`[scripts] env var \`${envKey}\` does not map to any configured \`scripts.globals\` key.${suggestion2}`
|
|
1451
|
+
);
|
|
1452
|
+
continue;
|
|
1453
|
+
}
|
|
1454
|
+
if (allValidEnvKeys.includes(envKey))
|
|
1455
|
+
continue;
|
|
1456
|
+
const segment = envKey.slice(ENV_PREFIX.length);
|
|
1457
|
+
let matchedKey;
|
|
1458
|
+
for (const [screaming, info] of validByKey) {
|
|
1459
|
+
if (segment === screaming || segment.startsWith(`${screaming}_`)) {
|
|
1460
|
+
matchedKey = { screaming, ...info };
|
|
1461
|
+
break;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
if (matchedKey) {
|
|
1465
|
+
const field = segment.slice(matchedKey.screaming.length + 1);
|
|
1466
|
+
logger.warn(
|
|
1467
|
+
`[scripts] env var \`${envKey}\` does not match any option on \`${matchedKey.camel}\`. Valid fields: ${[...matchedKey.fields].map((f) => `\`${ENV_PREFIX}${matchedKey.screaming}_${f}\``).join(", ")}.${field ? ` Got: \`${field}\`.` : ""}`
|
|
1468
|
+
);
|
|
1469
|
+
continue;
|
|
1470
|
+
}
|
|
1471
|
+
const segmentParts = segment.split("_");
|
|
1472
|
+
let substringMatch;
|
|
1473
|
+
for (const [screaming, info] of validByKey) {
|
|
1474
|
+
const keyParts = screaming.split("_");
|
|
1475
|
+
for (let i = 0; i <= segmentParts.length - keyParts.length; i++) {
|
|
1476
|
+
let ok = true;
|
|
1477
|
+
for (let j = 0; j < keyParts.length; j++) {
|
|
1478
|
+
if (segmentParts[i + j] !== keyParts[j]) {
|
|
1479
|
+
ok = false;
|
|
1480
|
+
break;
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
if (ok) {
|
|
1484
|
+
substringMatch = {
|
|
1485
|
+
screaming,
|
|
1486
|
+
camel: info.camel,
|
|
1487
|
+
fields: info.fields,
|
|
1488
|
+
remainder: segmentParts.slice(i + keyParts.length).join("_")
|
|
1489
|
+
};
|
|
1490
|
+
break;
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
if (substringMatch)
|
|
1494
|
+
break;
|
|
1495
|
+
}
|
|
1496
|
+
let suggestion = "";
|
|
1497
|
+
if (substringMatch) {
|
|
1498
|
+
if (substringMatch.remainder && substringMatch.fields.has(substringMatch.remainder)) {
|
|
1499
|
+
suggestion = ` Did you mean \`${ENV_PREFIX}${substringMatch.screaming}_${substringMatch.remainder}\` (registry key \`${substringMatch.camel}\`)?`;
|
|
1500
|
+
} else {
|
|
1501
|
+
suggestion = ` Did you mean registry key \`${substringMatch.camel}\` (\`${ENV_PREFIX}${substringMatch.screaming}_*\`)?`;
|
|
1502
|
+
}
|
|
1503
|
+
} else {
|
|
1504
|
+
let best;
|
|
1505
|
+
for (const [screaming, info] of validByKey) {
|
|
1506
|
+
const head = segmentParts.slice(0, screaming.split("_").length).join("_");
|
|
1507
|
+
const d = levenshtein(head, screaming);
|
|
1508
|
+
if (!best || d < best.dist)
|
|
1509
|
+
best = { key: screaming, camel: info.camel, dist: d };
|
|
1510
|
+
}
|
|
1511
|
+
if (best && best.dist <= Math.max(2, Math.floor(best.key.length / 2)))
|
|
1512
|
+
suggestion = ` Did you mean registry key \`${best.camel}\` (\`${ENV_PREFIX}${best.key}_*\`)?`;
|
|
1513
|
+
}
|
|
1514
|
+
logger.warn(
|
|
1515
|
+
`[scripts] env var \`${envKey}\` does not map to any registered script.${suggestion}`
|
|
1516
|
+
);
|
|
1517
|
+
}
|
|
1518
|
+
for (const [screaming, info] of validByKey) {
|
|
1519
|
+
if (enabledRegistryKeys.has(info.camel))
|
|
1520
|
+
continue;
|
|
1521
|
+
for (const field of info.fields) {
|
|
1522
|
+
const envKey = `${ENV_PREFIX}${screaming}_${field}`;
|
|
1523
|
+
if (process.env[envKey] !== void 0) {
|
|
1524
|
+
logger.warn(
|
|
1525
|
+
`[scripts] env var \`${envKey}\` is set but \`${info.camel}\` is not registered in \`scripts.registry\`. Add \`registry: { ${info.camel}: {} }\` to your nuxt.config for it to take effect.`
|
|
1526
|
+
);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1336
1532
|
const SELF_CLOSING_SCRIPT_RE = /<((?:Script[A-Z]|script-)\w[\w-]*)\b([^>]*?)\/\s*>/g;
|
|
1337
1533
|
function fixSelfClosingScriptComponents(nuxt) {
|
|
1338
1534
|
function expandTags(content) {
|
|
@@ -1483,6 +1679,10 @@ function resolveConfiguredProxyDomains(config, proxyConfig) {
|
|
|
1483
1679
|
}
|
|
1484
1680
|
return [...domains].sort();
|
|
1485
1681
|
}
|
|
1682
|
+
function findMissingRequiredFields(requiredFields, rawInput, mergedPublicScript) {
|
|
1683
|
+
const { scriptOptions: _, ...effectiveInput } = mergedPublicScript ?? rawInput ?? {};
|
|
1684
|
+
return requiredFields.filter((f) => !effectiveInput[f]);
|
|
1685
|
+
}
|
|
1486
1686
|
const module$1 = defineNuxtModule({
|
|
1487
1687
|
meta: {
|
|
1488
1688
|
name: "@nuxt/scripts",
|
|
@@ -1573,6 +1773,12 @@ const module$1 = defineNuxtModule({
|
|
|
1573
1773
|
registryWithDefaults
|
|
1574
1774
|
);
|
|
1575
1775
|
}
|
|
1776
|
+
validateScriptsEnvVars(
|
|
1777
|
+
scripts,
|
|
1778
|
+
new Set(Object.keys(config.registry || {}).filter((k) => config.registry?.[k] !== false)),
|
|
1779
|
+
logger,
|
|
1780
|
+
Object.keys(config.globals || {})
|
|
1781
|
+
);
|
|
1576
1782
|
const googleMapsEnabled = config.googleStaticMapsProxy?.enabled || !!config.registry?.googleMaps;
|
|
1577
1783
|
nuxt.options.runtimeConfig["nuxt-scripts"] = {
|
|
1578
1784
|
version,
|
|
@@ -1587,6 +1793,11 @@ const module$1 = defineNuxtModule({
|
|
|
1587
1793
|
// Only expose enabled and cacheMaxAge to client, not apiKey
|
|
1588
1794
|
googleStaticMapsProxy: googleMapsEnabled ? { enabled: true, cacheMaxAge: config.googleStaticMapsProxy?.cacheMaxAge ?? 3600 } : void 0
|
|
1589
1795
|
};
|
|
1796
|
+
const debugConst = JSON.stringify(!!config.debug);
|
|
1797
|
+
nuxt.options.vite ||= {};
|
|
1798
|
+
nuxt.options.vite.define = { ...nuxt.options.vite.define, __NUXT_SCRIPTS_DEBUG__: debugConst };
|
|
1799
|
+
nuxt.options.nitro ||= {};
|
|
1800
|
+
nuxt.options.nitro.replace = { ...nuxt.options.nitro.replace, __NUXT_SCRIPTS_DEBUG__: debugConst };
|
|
1590
1801
|
const scriptsBase = config.prefix || "/_scripts";
|
|
1591
1802
|
const proxyPrefix = `${scriptsBase}/p`;
|
|
1592
1803
|
const assetsPrefix = `${scriptsBase}/assets`;
|
|
@@ -1659,7 +1870,8 @@ const module$1 = defineNuxtModule({
|
|
|
1659
1870
|
const willAutoLoad = scriptOptions && "trigger" in scriptOptions && scriptOptions.trigger !== false;
|
|
1660
1871
|
if (willAutoLoad) {
|
|
1661
1872
|
const requiredFields = extractRequiredFields(script.schema);
|
|
1662
|
-
const
|
|
1873
|
+
const publicScripts = nuxt.options.runtimeConfig.public?.scripts ?? {};
|
|
1874
|
+
const missing = findMissingRequiredFields(requiredFields, input, publicScripts[key]);
|
|
1663
1875
|
if (missing.length) {
|
|
1664
1876
|
logger.warn(`[nuxt-scripts] registry.${key}: missing required field${missing.length > 1 ? "s" : ""} ${missing.map((f) => `'${f}'`).join(", ")}. The script infrastructure is registered but will not function without ${missing.length > 1 ? "them" : "it"}.`);
|
|
1665
1877
|
}
|
|
@@ -1673,6 +1885,26 @@ const module$1 = defineNuxtModule({
|
|
|
1673
1885
|
}
|
|
1674
1886
|
}
|
|
1675
1887
|
}
|
|
1888
|
+
if (Object.keys(config.globals || {}).length) {
|
|
1889
|
+
const globalsRuntime = {};
|
|
1890
|
+
for (const [k, c] of Object.entries(config.globals || {})) {
|
|
1891
|
+
let input;
|
|
1892
|
+
if (typeof c === "string")
|
|
1893
|
+
input = { src: c };
|
|
1894
|
+
else if (Array.isArray(c) && c.length === 2)
|
|
1895
|
+
input = typeof c[0] === "string" ? { src: c[0] } : { ...c[0] };
|
|
1896
|
+
else if (typeof c === "object" && c !== null)
|
|
1897
|
+
input = { ...c };
|
|
1898
|
+
else
|
|
1899
|
+
continue;
|
|
1900
|
+
delete input.trigger;
|
|
1901
|
+
globalsRuntime[k] = input;
|
|
1902
|
+
}
|
|
1903
|
+
nuxt.options.runtimeConfig.public.scriptsGlobals = defu(
|
|
1904
|
+
globalsRuntime,
|
|
1905
|
+
nuxt.options.runtimeConfig.public.scriptsGlobals
|
|
1906
|
+
);
|
|
1907
|
+
}
|
|
1676
1908
|
nuxt.hooks.hook("modules:done", async () => {
|
|
1677
1909
|
const registryScripts = [...scripts];
|
|
1678
1910
|
await nuxt.hooks.callHook("scripts:registry", registryScripts);
|
|
@@ -1924,4 +2156,4 @@ Options: configure platform rewrites, switch to server-rendered mode, or disable
|
|
|
1924
2156
|
}
|
|
1925
2157
|
});
|
|
1926
2158
|
|
|
1927
|
-
export { applyAutoInject, module$1 as default, isProxyDisabled, resolveConfiguredProxyDomains, resolveProxySecret };
|
|
2159
|
+
export { applyAutoInject, module$1 as default, findMissingRequiredFields, isProxyDisabled, resolveConfiguredProxyDomains, resolveProxySecret };
|