@nuxt/scripts 0.3.7 → 0.3.9

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.
@@ -0,0 +1 @@
1
+ import{i as d,u as f,r as i,f as h,g as p,h as v,j as m,k as y,l as g}from"./BwVNWVdS.js";let _;function b(){return _}function j(e){return typeof e=="function"?e():f(e)}function s(e,a=""){if(e instanceof Promise)return e;const t=j(e);return!e||!t?t:Array.isArray(t)?t.map(n=>s(n,a)):typeof t=="object"?Object.fromEntries(Object.entries(t).map(([n,o])=>n==="titleTemplate"||n.startsWith("on")?[n,f(o)]:[n,s(o,n)])):t}const w="usehead",u=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c="__unhead_injection_handler__";function H(){if(c in u)return u[c]();const e=d(w);return e||b()}function T(e,a={}){const t=a.head||H();if(t)return t.ssr?t.push(e,a):x(t,e,a)}function x(e,a,t={}){const n=i(!1),o=i({});h(()=>{o.value=n.value?{}:s(a)});const r=e.push(o.value,t);return p(o,l=>{r.patch(l)}),g()&&(v(()=>{r.dispose()}),m(()=>{n.value=!0}),y(()=>{n.value=!1})),r}const I=(e,a)=>{const t=e.__vccOpts||e;for(const[n,o]of a)t[n]=o;return t};export{I as _,T as u};
@@ -1 +1 @@
1
- import{o as a,c as s,a as e,t as o,b as i,w as u,d as c,_ as d,p as l,e as p}from"./B-fFasPr.js";import{_ as h,u as b}from"./CiZWPqqg.js";const f=t=>(l("data-v-bd6e1038"),t=t(),p(),t),g={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},x=f(()=>e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),m={class:"max-w-520px text-center z-20"},y=["textContent"],_=["textContent"],k={class:"w-full flex items-center justify-center"},w={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"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(t){const n=t;return b({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[],style:[{children:'*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--un-default-border-color, #e5e7eb)}:before,:after{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;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;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:before,:after{--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 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(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: }'}]}),(z,S)=>{const r=d;return a(),s("div",g,[x,e("div",m,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:o(t.statusCode)},null,8,y),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:o(t.description)},null,8,_),e("div",k,[i(r,{to:"/",class:"gradient-border text-md sm:text-xl py-2 px-4 sm:py-3 sm:px-6 cursor-pointer"},{default:u(()=>[c(o(t.backHome),1)]),_:1})])])])}}},N=h(w,[["__scopeId","data-v-bd6e1038"]]);export{N as default};
1
+ import{o as a,c as s,a as e,t as o,b as i,w as u,d as c,_ as d,p as l,e as p}from"./BwVNWVdS.js";import{_ as h,u as b}from"./Df--iwTR.js";const f=t=>(l("data-v-bd6e1038"),t=t(),p(),t),g={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},x=f(()=>e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),m={class:"max-w-520px text-center z-20"},y=["textContent"],_=["textContent"],k={class:"w-full flex items-center justify-center"},w={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"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(t){const n=t;return b({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[],style:[{children:'*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--un-default-border-color, #e5e7eb)}:before,:after{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;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;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:before,:after{--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 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(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: }'}]}),(z,S)=>{const r=d;return a(),s("div",g,[x,e("div",m,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:o(t.statusCode)},null,8,y),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:o(t.description)},null,8,_),e("div",k,[i(r,{to:"/",class:"gradient-border text-md sm:text-xl py-2 px-4 sm:py-3 sm:px-6 cursor-pointer"},{default:u(()=>[c(o(t.backHome),1)]),_:1})])])])}}},N=h(w,[["__scopeId","data-v-bd6e1038"]]);export{N as default};
@@ -1 +1 @@
1
- {"id":"1cefd89e-54fa-4e92-a907-17cf4831c9c1","timestamp":1714973408428}
1
+ {"id":"42eedd27-01ea-43c5-acca-daf3456cac3d","timestamp":1715047560600}
@@ -0,0 +1 @@
1
+ {"id":"42eedd27-01ea-43c5-acca-daf3456cac3d","timestamp":1715047560600,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html><html><head><meta charset="utf-8">
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1">
3
3
  <link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.D91GVkD7.css">
4
- <link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/B-fFasPr.js">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BwVNWVdS.js">
5
5
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DXFkqnOI.js">
6
6
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/D6NljDpC.js">
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CowR2XfX.js">
@@ -239,10 +239,10 @@
239
239
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/V_y36BGi.js">
240
240
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BGq4KZyx.js">
241
241
  <link rel="prefetch" as="style" href="/__nuxt-scripts/_nuxt/error-404.BRldFSII.css">
242
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/D8ABSIOn.js">
243
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CiZWPqqg.js">
242
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/Dmsejhs1.js">
243
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/Df--iwTR.js">
244
244
  <link rel="prefetch" as="style" href="/__nuxt-scripts/_nuxt/error-500.D8yw_IbC.css">
245
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/B_Rrd6XA.js">
246
- <script type="module" src="/__nuxt-scripts/_nuxt/B-fFasPr.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,c=window.localStorage,d=["dark","light"],n=c&&c.getItem&&c.getItem("nuxt-color-mode")||"system";let l=n==="system"?f():n;const i=e.getAttribute("data-color-mode-forced");i&&(l=i),r(l),a["__NUXT_COLOR_MODE__"]={preference:n,value:l,getColorScheme:f,addColorScheme:r,removeColorScheme:u};function r(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function u(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function m(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function f(){if(a.matchMedia&&m("").media!=="not all"){for(const o of d)if(m(":"+o).matches)return o}return"light"}})();
245
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BRKoJ6lw.js">
246
+ <script type="module" src="/__nuxt-scripts/_nuxt/BwVNWVdS.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,c=window.localStorage,d=["dark","light"],n=c&&c.getItem&&c.getItem("nuxt-color-mode")||"system";let l=n==="system"?f():n;const i=e.getAttribute("data-color-mode-forced");i&&(l=i),r(l),a["__NUXT_COLOR_MODE__"]={preference:n,value:l,getColorScheme:f,addColorScheme:r,removeColorScheme:u};function r(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function u(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function m(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function f(){if(a.matchMedia&&m("").media!=="not all"){for(const o of d)if(m(":"+o).matches)return o}return"light"}})();
247
247
  </script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4,"once":5},{},false,{},{},["Set"]]</script>
248
248
  <script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{defaultScriptOptions:{trigger:"onNuxtReady"}}},app:{baseURL:"/__nuxt-scripts",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "nuxt": ">=3",
6
6
  "bridge": false
7
7
  },
8
- "version": "0.3.7",
8
+ "version": "0.3.9",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.6.0",
11
11
  "unbuild": "2.0.0"
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { ref } from 'vue'
3
3
  import type { ElementScriptTrigger } from '../composables/useElementScriptTrigger'
4
- import { useElementScriptTrigger, useScript } from '#imports'
4
+ import { onBeforeUnmount, useElementScriptTrigger, useScript } from '#imports'
5
5
 
6
6
  const props = withDefaults(defineProps<{
7
7
  trigger?: ElementScriptTrigger
@@ -18,28 +18,37 @@ const emit = defineEmits<{
18
18
  ready: []
19
19
  }>()
20
20
 
21
- const rootEl = ref()
21
+ const rootEl = ref<HTMLDivElement | undefined>()
22
+ const containerEl = ref<HTMLDivElement | undefined>()
22
23
  const { $script } = useScript(`https://js.stripe.com/v3/pricing-table.js`, {
23
24
  trigger: useElementScriptTrigger({ trigger: props.trigger, el: rootEl }),
24
25
  })
25
26
 
27
+ const pricingTable = ref<HTMLElement | undefined>()
26
28
  $script.then(() => {
29
+ const StripePricingTable = window.customElements.get('stripe-pricing-table')!
30
+ const stripePricingTable = new StripePricingTable()
31
+ stripePricingTable.setAttribute('publishable-key', props.publishableKey)
32
+ stripePricingTable.setAttribute('pricing-table-id', props.pricingTableId)
33
+ if (props.clientReferenceId)
34
+ stripePricingTable.setAttribute('client-reference-id', props.clientReferenceId)
35
+ if (props.customerEmail)
36
+ stripePricingTable.setAttribute('customer-email', props.customerEmail)
37
+ if (props.customerSessionClientSecret)
38
+ stripePricingTable.setAttribute('customer-session-client-secret', props.customerSessionClientSecret)
39
+ pricingTable.value = stripePricingTable
40
+ rootEl.value!.appendChild(stripePricingTable)
27
41
  emit('ready')
28
42
  })
43
+
44
+ onBeforeUnmount(() => {
45
+ pricingTable.value?.remove()
46
+ })
29
47
  </script>
30
48
 
31
49
  <template>
32
50
  <div ref="rootEl">
33
- <ClientOnly>
34
- <stripe-pricing-table
35
- v-bind="$attrs"
36
- :publishable-key="publishableKey"
37
- :pricing-table-id="pricingTableId"
38
- :client-reference-id="clientReferenceId"
39
- :customer-email="customerEmail"
40
- :customer-session-client-secret="customerSessionClientSecret"
41
- />
42
- </ClientOnly>
51
+ <div ref="containerEl" />
43
52
  <slot v-if="$script.status.value === 'loading'" name="loading" />
44
53
  <slot v-if="$script.status.value === 'awaitingLoad'" name="awaitingLoad" />
45
54
  <slot />
@@ -1,4 +1,3 @@
1
- import { defu } from "defu";
2
1
  import { useRegistryScript } from "../utils.mjs";
3
2
  import { boolean, minLength, object, optional, string } from "#nuxt-scripts-validator";
4
3
  export const CloudflareWebAnalyticsOptions = object({
@@ -18,7 +17,9 @@ export function useScriptCloudflareWebAnalytics(_options) {
18
17
  return useRegistryScript("cloudflareWebAnalytics", (options) => ({
19
18
  scriptInput: {
20
19
  "src": "https://static.cloudflareinsights.com/beacon.min.js",
21
- "data-cf-beacon": JSON.stringify(defu(options, { spa: true }))
20
+ "data-cf-beacon": JSON.stringify({ token: options.token, spa: options.spa || true }),
21
+ // @ts-expect-error untyped TODO fix upstream
22
+ "crossorigin": false
22
23
  },
23
24
  schema: import.meta.dev ? CloudflareWebAnalyticsOptions : void 0,
24
25
  scriptOptions: {
@@ -11,7 +11,9 @@ export const MatomoAnalyticsOptions = object({
11
11
  export function useScriptMatomoAnalytics(_options) {
12
12
  return useRegistryScript("matomoAnalytics", (options) => ({
13
13
  scriptInput: {
14
- src: withBase(`/matomo.js`, withHttps(options?.matomoUrl))
14
+ src: withBase(`/matomo.js`, withHttps(options?.matomoUrl)),
15
+ // @ts-expect-error untyped TODO fix upstream
16
+ crossorigin: false
15
17
  },
16
18
  schema: import.meta.dev ? MatomoAnalyticsOptions : void 0,
17
19
  scriptOptions: {
@@ -18,7 +18,7 @@ export function useRegistryScript(key, optionsFn, _userOptions) {
18
18
  const scriptConfig = scriptRuntimeConfig(key);
19
19
  const userOptions = Object.assign(_userOptions || {}, typeof scriptConfig === "object" ? scriptConfig : {});
20
20
  const options = optionsFn(userOptions);
21
- const scriptInput = defu(options.scriptInput, { key });
21
+ const scriptInput = defu(userOptions.scriptInput, options.scriptInput, { key });
22
22
  const scriptOptions = Object.assign(userOptions?.scriptOptions || {}, options.scriptOptions || {});
23
23
  const init = scriptOptions.beforeInit;
24
24
  scriptOptions.beforeInit = () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/scripts",
3
3
  "type": "module",
4
- "version": "0.3.7",
4
+ "version": "0.3.9",
5
5
  "description": "Load third-party scripts with better performance, privacy and DX in Nuxt Apps.",
6
6
  "author": {
7
7
  "website": "https://harlanzw.com",
@@ -47,7 +47,7 @@
47
47
  "@types/stripe-v3": "^3.1.33",
48
48
  "@types/vimeo__player": "^2.18.3",
49
49
  "@types/youtube": "^0.0.50",
50
- "@unhead/vue": "^1.9.9",
50
+ "@unhead/vue": "^1.9.10",
51
51
  "@vueuse/core": "^10.9.0",
52
52
  "consola": "^3.2.3",
53
53
  "defu": "^6.1.4",
@@ -75,22 +75,22 @@
75
75
  "@nuxt/devtools-ui-kit": "^1.2.0",
76
76
  "@nuxt/module-builder": "^0.6.0",
77
77
  "@nuxt/test-utils": "3.12.1",
78
- "@unhead/schema": "^1.9.9",
78
+ "@unhead/schema": "^1.9.10",
79
79
  "acorn-loose": "^8.4.0",
80
80
  "bumpp": "^9.4.1",
81
81
  "eslint": "9.2.0",
82
82
  "nuxt": "^3.11.2",
83
- "playwright-core": "^1.43.1",
83
+ "playwright-core": "^1.44.0",
84
84
  "typescript": "^5.4.5",
85
85
  "vitest": "^1.6.0",
86
- "vue": "^3.4.26",
86
+ "vue": "^3.4.27",
87
87
  "vue-router": "^4.3.2"
88
88
  },
89
89
  "resolutions": {
90
90
  "@nuxt/scripts": "workspace:*",
91
91
  "nuxt": "^3.11.2",
92
92
  "nuxt-scripts-devtools": "workspace:*",
93
- "vue": "^3.4.26",
93
+ "vue": "^3.4.27",
94
94
  "vue-router": "^4.3.2"
95
95
  },
96
96
  "scripts": {
@@ -1 +0,0 @@
1
- import{i as u,r as c,f,g as v,h as d,j as l,k as i,l as h,m as p}from"./B-fFasPr.js";function g(t,a={}){const e=a.head||u();if(e)return e.ssr?e.push(t,a):m(e,t,a)}function m(t,a,e={}){const s=c(!1),n=c({});f(()=>{n.value=s.value?{}:h(a)});const r=t.push(n.value,e);return v(n,o=>{r.patch(o)}),p()&&(d(()=>{r.dispose()}),l(()=>{s.value=!0}),i(()=>{s.value=!1})),r}const I=(t,a)=>{const e=t.__vccOpts||t;for(const[s,n]of a)e[s]=n;return e};export{I as _,g as u};
@@ -1 +0,0 @@
1
- {"id":"1cefd89e-54fa-4e92-a907-17cf4831c9c1","timestamp":1714973408428,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}